WordPress.org

Make WordPress Core

Ticket #15130: lock.diff

File lock.diff, 1.4 KB (added by lancehudson, 8 years ago)
  • wp-admin/includes/post.php

     
    11301130                return false;
    11311131
    11321132        $lock = get_post_meta( $post->ID, '_edit_lock', true );
    1133         $last = get_post_meta( $post->ID, '_edit_last', true );
     1133        $last = get_post_meta( $post->ID, '_edit_lock_user', true );
    11341134
    11351135        $time_window = apply_filters( 'wp_check_post_lock_window', AUTOSAVE_INTERVAL * 2 );
    11361136
     
    11561156        $now = time();
    11571157
    11581158        update_post_meta( $post->ID, '_edit_lock', $now );
     1159        update_post_meta( $post->ID, '_edit_lock_user', get_current_user_id() );
    11591160}
    11601161
    11611162/**
     
    11661167 */
    11671168function _admin_notice_post_locked() {
    11681169        global $post;
    1169         $last_user = get_userdata( get_post_meta( $post->ID, '_edit_last', true ) );
    1170         $last_user_name = $last_user ? $last_user->display_name : __('Somebody');
     1170        $lock_user = get_userdata( get_post_meta( $post->ID, '_edit_lock_user', true ) );
     1171        $lock_user_name = $lock_user ? $lock_user->display_name : __('Somebody');
    11711172
    11721173        switch ($post->post_type) {
    11731174                case 'post':
     
    11801181                        $message = __( 'Warning: %s is currently editing this.' );
    11811182        }
    11821183
    1183         $message = sprintf( $message, esc_html( $last_user_name ) );
     1184        $message = sprintf( $message, esc_html( $lock_user_name ) );
    11841185        echo "<div class='error'><p>$message</p></div>";
    11851186}
    11861187