Ticket #24572: wp_unset_post_lock.patch
File wp_unset_post_lock.patch, 2.0 KB (added by , 11 years ago) |
---|
-
wp-admin/includes/ajax-actions.php
Property changes on: . ___________________________________________________________________ Added: svn:ignore + wp-config.php
1757 1757 if ( $active_lock[1] != get_current_user_id() ) 1758 1758 wp_die( 0 ); 1759 1759 1760 $new_lock = ( time() - apply_filters( 'wp_check_post_lock_window', 120 ) + 5 ) . ':' . $active_lock[1]; 1761 update_post_meta( $post_id, '_edit_lock', $new_lock, implode( ':', $active_lock ) ); 1762 wp_die( 1 ); 1760 $unlock_result = wp_unset_post_lock( $post_id ); 1761 1762 if( is_array( $unlock_result ) ) 1763 wp_die( 1 ); 1764 else 1765 wp_die( 0 ); 1763 1766 } 1764 1767 1765 1768 function wp_ajax_dismiss_wp_pointer() { -
wp-admin/includes/post.php
1186 1186 return array( $now, $user_id ); 1187 1187 } 1188 1188 1189 1189 1190 /** 1191 * Mark the post as no longer being edited by the current user by setting the 1192 * last lock timestamp to a time in the recent past 1193 * 1194 * @since 3.6.0 1195 * 1196 * @param int $post_id ID of the post to being edited 1197 * @return bool|array Returns false if the post doesn't exist of there is no current user, or 1198 * an array of the last lock time and the user ID. 1199 */ 1200 function wp_unset_post_lock( $post_id ) { 1201 1202 if ( !$post = get_post( $post_id ) ) 1203 return false; 1204 if ( 0 == ($user_id = get_current_user_id()) ) 1205 return false; 1206 1207 // Set post lock time to a time in recent past 1208 $then = time() - apply_filters( 'wp_check_post_lock_window', 120 ) + 5; 1209 $removal_lock = "$then:$user_id"; 1210 1211 update_post_meta( $post->ID, '_edit_lock', $removal_lock ); 1212 return array( $then, $user_id ); 1213 } 1214 1215 /** 1190 1216 * Outputs the HTML for the notice to say that someone else is editing or has taken over editing of this post. 1191 1217 * 1192 1218 * @since 2.8.5