Skip to content

Commit

Permalink
Posts, Post Types: In wp_check_post_lock(), check if the user with …
Browse files Browse the repository at this point in the history
…lock exists and return false otherwise.

Props arshidkv12, 1naveengiri.
Fixes #39888.
Built from https://develop.svn.wordpress.org/trunk@40424


git-svn-id: http://core.svn.wordpress.org/trunk@40322 1a063a9b-81f0-0310-95a4-ce76da25c4cd
  • Loading branch information
SergeyBiryukov committed Apr 13, 2017
1 parent bef3ff1 commit 9fb2e79
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 4 deletions.
10 changes: 7 additions & 3 deletions wp-admin/includes/post.php
Original file line number Diff line number Diff line change
Expand Up @@ -1450,7 +1450,7 @@ function _wp_post_thumbnail_html( $thumbnail_id = null, $post = null ) {
*
* @param int $post_id ID of the post to check for editing.
* @return int|false ID of the user with lock. False if the post does not exist, post is not locked,
* or post is locked by current user.
* the user with lock does not exist, or the post is locked by current user.
*/
function wp_check_post_lock( $post_id ) {
if ( ! $post = get_post( $post_id ) ) {
Expand All @@ -1465,6 +1465,10 @@ function wp_check_post_lock( $post_id ) {
$time = $lock[0];
$user = isset( $lock[1] ) ? $lock[1] : get_post_meta( $post->ID, '_edit_last', true );

if ( ! get_userdata( $user ) ) {
return false;
}

/** This filter is documented in wp-admin/includes/ajax-actions.php */
$time_window = apply_filters( 'wp_check_post_lock_window', 150 );

Expand All @@ -1481,8 +1485,8 @@ function wp_check_post_lock( $post_id ) {
* @since 2.5.0
*
* @param int $post_id ID of the post being edited.
* @return array|false Array of the lock time and user ID. False if the post does not exist or there
* is no current user.
* @return array|false Array of the lock time and user ID. False if the post does not exist, or
* there is no current user.
*/
function wp_set_post_lock( $post_id ) {
if ( ! $post = get_post( $post_id ) ) {
Expand Down
2 changes: 1 addition & 1 deletion wp-includes/version.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
*
* @global string $wp_version
*/
$wp_version = '4.8-alpha-40423';
$wp_version = '4.8-alpha-40424';

/**
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.
Expand Down

0 comments on commit 9fb2e79

Please sign in to comment.