WordPress.org

Make WordPress Core


Ignore:
Timestamp:
04/22/2013 03:08:51 AM (9 years ago)
Author:
azaozz
Message:

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.
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/wp-admin/includes/misc.php

    r23683 r24042  
    575575
    576576            if ( current_user_can( 'edit_post', $post_id ) && ( $user_id = wp_check_post_lock( $post_id ) ) && ( $user = get_userdata( $user_id ) ) ) {
    577                 $send = array();
     577                $send = array( 'text' => sprintf( __( '%s is currently editing' ), $user->display_name ) );
    578578
    579579                if ( ( $avatar = get_avatar( $user->ID, 18 ) ) && preg_match( "|src='([^']+)'|", $avatar, $matches ) )
    580580                    $send['avatar_src'] = $matches[1];
    581581
    582                 $send['text'] = sprintf( __( '%s is currently editing' ), $user->display_name );
    583582                $checked[$key] = $send;
    584583            }
     
    609608            return $response;
    610609
    611         if ( $user_id = wp_check_post_lock( $post_id ) ) {
    612             $user = get_userdata( $user_id );
    613 
     610        if ( ( $user_id = wp_check_post_lock( $post_id ) ) && ( $user = get_userdata( $user_id ) ) ) {
    614611            $error = array(
    615612                'text' => sprintf( __( '%s has taken over and is currently editing.' ), $user->display_name )
Note: See TracChangeset for help on using the changeset viewer.