Only show "saved at" when the post was actually saved. Props mdawaffe. fixes #6053
git-svn-id: http://svn.automattic.com/wordpress/trunk@7138 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
parent
0ab4077b3c
commit
5504c11b58
|
@ -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…
Reference in New Issue