Post locks:

- Show 'Saving revision...' while autosaving after a post has been taken over. Change to 'Your latest changes were saved as a revision.' when autosave completes.
- Make sure a user exists before using $user->display_name.
- Add 'post_lock_text' action for extending the message text.

git-svn-id: https://develop.svn.wordpress.org/trunk@24042 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
Andrew Ozz
2013-04-22 03:08:51 +00:00
parent db96892205
commit 008336ee9c
5 changed files with 37 additions and 13 deletions

View File

@@ -574,12 +574,11 @@ function wp_check_locked_posts( $response, $data, $screen_id ) {
$post_id = (int) substr( $key, 5 );
if ( current_user_can( 'edit_post', $post_id ) && ( $user_id = wp_check_post_lock( $post_id ) ) && ( $user = get_userdata( $user_id ) ) ) {
$send = array();
$send = array( 'text' => sprintf( __( '%s is currently editing' ), $user->display_name ) );
if ( ( $avatar = get_avatar( $user->ID, 18 ) ) && preg_match( "|src='([^']+)'|", $avatar, $matches ) )
$send['avatar_src'] = $matches[1];
$send['text'] = sprintf( __( '%s is currently editing' ), $user->display_name );
$checked[$key] = $send;
}
}
@@ -608,9 +607,7 @@ function wp_refresh_post_lock( $response, $data, $screen_id ) {
if ( !current_user_can('edit_post', $post_id) )
return $response;
if ( $user_id = wp_check_post_lock( $post_id ) ) {
$user = get_userdata( $user_id );
if ( ( $user_id = wp_check_post_lock( $post_id ) ) && ( $user = get_userdata( $user_id ) ) ) {
$error = array(
'text' => sprintf( __( '%s has taken over and is currently editing.' ), $user->display_name )
);