don't get or set post_lock if you can't edit the post/page. Props mdawaffe
git-svn-id: https://develop.svn.wordpress.org/trunk@7781 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
parent
393f8a33a5
commit
202cb03220
@ -83,15 +83,18 @@ case 'edit':
|
|||||||
wp_enqueue_script('editor');
|
wp_enqueue_script('editor');
|
||||||
wp_enqueue_script('thickbox');
|
wp_enqueue_script('thickbox');
|
||||||
wp_enqueue_script('media-upload');
|
wp_enqueue_script('media-upload');
|
||||||
if ( $last = wp_check_post_lock( $post->ID ) ) {
|
|
||||||
$last_user = get_userdata( $last );
|
if ( current_user_can('edit_page', $page_ID) ) {
|
||||||
$last_user_name = $last_user ? $last_user->display_name : __('Somebody');
|
if ( $last = wp_check_post_lock( $post->ID ) ) {
|
||||||
$message = sprintf( __( 'Warning: %s is currently editing this page' ), wp_specialchars( $last_user_name ) );
|
$last_user = get_userdata( $last );
|
||||||
$message = str_replace( "'", "\'", "<div class='error'><p>$message</p></div>" );
|
$last_user_name = $last_user ? $last_user->display_name : __('Somebody');
|
||||||
add_action('admin_notices', create_function( '', "echo '$message';" ) );
|
$message = sprintf( __( 'Warning: %s is currently editing this page' ), wp_specialchars( $last_user_name ) );
|
||||||
} else {
|
$message = str_replace( "'", "\'", "<div class='error'><p>$message</p></div>" );
|
||||||
wp_set_post_lock( $post->ID );
|
add_action('admin_notices', create_function( '', "echo '$message';" ) );
|
||||||
wp_enqueue_script('autosave');
|
} else {
|
||||||
|
wp_set_post_lock( $post->ID );
|
||||||
|
wp_enqueue_script('autosave');
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
require_once('admin-header.php');
|
require_once('admin-header.php');
|
||||||
|
@ -90,15 +90,18 @@ case 'edit':
|
|||||||
wp_enqueue_script('editor');
|
wp_enqueue_script('editor');
|
||||||
wp_enqueue_script('thickbox');
|
wp_enqueue_script('thickbox');
|
||||||
wp_enqueue_script('media-upload');
|
wp_enqueue_script('media-upload');
|
||||||
if ( $last = wp_check_post_lock( $post->ID ) ) {
|
|
||||||
$last_user = get_userdata( $last );
|
if ( current_user_can('edit_post', $post_ID) ) {
|
||||||
$last_user_name = $last_user ? $last_user->display_name : __('Somebody');
|
if ( $last = wp_check_post_lock( $post->ID ) ) {
|
||||||
$message = sprintf( __( 'Warning: %s is currently editing this post' ), wp_specialchars( $last_user_name ) );
|
$last_user = get_userdata( $last );
|
||||||
$message = str_replace( "'", "\'", "<div class='error'><p>$message</p></div>" );
|
$last_user_name = $last_user ? $last_user->display_name : __('Somebody');
|
||||||
add_action('admin_notices', create_function( '', "echo '$message';" ) );
|
$message = sprintf( __( 'Warning: %s is currently editing this post' ), wp_specialchars( $last_user_name ) );
|
||||||
} else {
|
$message = str_replace( "'", "\'", "<div class='error'><p>$message</p></div>" );
|
||||||
wp_set_post_lock( $post->ID );
|
add_action('admin_notices', create_function( '', "echo '$message';" ) );
|
||||||
wp_enqueue_script('autosave');
|
} else {
|
||||||
|
wp_set_post_lock( $post->ID );
|
||||||
|
wp_enqueue_script('autosave');
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
require_once('admin-header.php');
|
require_once('admin-header.php');
|
||||||
|
Loading…
Reference in New Issue
Block a user