$locked = false;
/** This filter is documented in wp-admin/includes/post.php */
if ( apply_filters( 'show_post_locked_dialog', true,
$post,
$user_id ) ) { $locked = true;
} $user_details = null;
if ( $locked ) { $user =
get_userdata( $user_id );
$user_details = array
( 'avatar' =>
get_avatar_url( $user_id, array
( 'size' => 128
) ),
'name' =>
$user->display_name,
);
} $lock_details = array
( 'isLocked' =>
$locked,
'user' =>
$user_details,
);
} else { // Lock the post.
$active_post_lock =
wp_set_post_lock( $post->ID
);