Only show "saved at" when the post was actually saved. Props mdawaffe. fixes #6053
git-svn-id: https://develop.svn.wordpress.org/trunk@7138 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
parent
7aa9161dc3
commit
b093ce1da2
@ -483,15 +483,18 @@ case 'autosave' : // The name of this action is hardcoded in edit_post()
|
||||
$do_autosave = (bool) $_POST['autosave'];
|
||||
$do_lock = true;
|
||||
|
||||
$data = '<div class="updated"><p>' . sprintf( __('Saved at %s.'), date( __('g:i:s a'), current_time( 'timestamp', true ) ) ) . '</p></div>';
|
||||
$data = '';
|
||||
$message = '<div class="updated"><p>' . sprintf( __('Saved at %s.'), date( __('g:i:s a'), current_time( 'timestamp', true ) ) ) . '</p></div>';
|
||||
|
||||
$supplemental = array();
|
||||
|
||||
$id = 0;
|
||||
if($_POST['post_ID'] < 0) {
|
||||
$_POST['temp_ID'] = $_POST['post_ID'];
|
||||
if ( $do_autosave )
|
||||
if ( $do_autosave ) {
|
||||
$id = wp_write_post();
|
||||
$data = $message;
|
||||
}
|
||||
} else {
|
||||
$post_ID = (int) $_POST['post_ID'];
|
||||
$_POST['ID'] = $post_ID;
|
||||
@ -517,10 +520,12 @@ case 'autosave' : // The name of this action is hardcoded in edit_post()
|
||||
if ( !current_user_can('edit_post', $post_ID) )
|
||||
die(__('You are not allowed to edit this post.'));
|
||||
}
|
||||
if ( $do_autosave )
|
||||
if ( $do_autosave ) {
|
||||
$id = wp_update_post($_POST);
|
||||
else
|
||||
$data = $message;
|
||||
} else {
|
||||
$id = $post->ID;
|
||||
}
|
||||
}
|
||||
|
||||
if ( $do_lock && $id && is_numeric($id) )
|
||||
|
@ -17,6 +17,7 @@ jQuery(function($) {
|
||||
|
||||
// called when autosaving pre-existing post
|
||||
function autosave_saved(response) {
|
||||
var oldMessage = jQuery('#autosave').html();
|
||||
var res = wpAjax.parseAjaxResponse(response, 'autosave'); // parse the ajax response
|
||||
var message = '';
|
||||
|
||||
@ -38,6 +39,7 @@ function autosave_saved(response) {
|
||||
}
|
||||
}
|
||||
if ( message ) { jQuery('#autosave').html(message); } // update autosave message
|
||||
else if ( oldMessage && res ) { jQuery('#autosave').html( oldMessage ); }
|
||||
autosave_enable_buttons(); // re-enable disabled form buttons
|
||||
return res;
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user