Fix two rare regressions: alert when the login has expires and when post is edited by another user, fixes #16928

git-svn-id: https://develop.svn.wordpress.org/trunk@17640 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
Andrew Ozz
2011-04-16 02:37:44 +00:00
parent 157571de2a
commit 6d0f618fd9
4 changed files with 18 additions and 17 deletions
+7 -6
View File
@@ -916,7 +916,7 @@ case 'autosave' : // The name of this action is hardcoded in edit_post()
$do_autosave = (bool) $_POST['autosave'];
$do_lock = true;
$data = '';
$data = $alert = '';
/* translators: draft saved date format, see http://php.net/date */
$draft_saved_date_format = __('g:i:s a');
/* translators: %s: date and time */
@@ -924,7 +924,7 @@ case 'autosave' : // The name of this action is hardcoded in edit_post()
$supplemental = array();
if ( isset($login_grace_period) )
$supplemental['session_expired'] = add_query_arg( 'interim-login', 1, wp_login_url() );
$alert .= sprintf( __('Your login has expired. Please open a new browser window and <a href="%s" target="_blank">login again</a>. '), add_query_arg( 'interim-login', 1, wp_login_url() ) );
$id = $revision_id = 0;
@@ -939,12 +939,10 @@ case 'autosave' : // The name of this action is hardcoded in edit_post()
$last_user = get_userdata( $last );
$last_user_name = $last_user ? $last_user->display_name : __( 'Someone' );
$data = new WP_Error( 'locked', sprintf(
$_POST['post_type'] == 'page' ? __( 'Autosave disabled: %s is currently editing this page.' ) : __( 'Autosave disabled: %s is currently editing this post.' ),
esc_html( $last_user_name )
) );
$data = __( 'Autosave disabled.' );
$supplemental['disable_autosave'] = 'disable';
$alert .= sprintf( __( '%s is currently editing this article. If you update it, you will overwrite the changes.' ), esc_html( $last_user_name ) );
}
if ( 'page' == $post->post_type ) {
@@ -990,6 +988,9 @@ case 'autosave' : // The name of this action is hardcoded in edit_post()
}
}
if ( ! empty($alert) )
$supplemental['alert'] = $alert;
$x = new WP_Ajax_Response( array(
'what' => 'autosave',
'id' => $id,