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:
Ryan Boren 2008-04-22 23:54:13 +00:00
parent 393f8a33a5
commit 202cb03220
2 changed files with 24 additions and 18 deletions

View File

@ -83,6 +83,8 @@ 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 ( current_user_can('edit_page', $page_ID) ) {
if ( $last = wp_check_post_lock( $post->ID ) ) { if ( $last = wp_check_post_lock( $post->ID ) ) {
$last_user = get_userdata( $last ); $last_user = get_userdata( $last );
$last_user_name = $last_user ? $last_user->display_name : __('Somebody'); $last_user_name = $last_user ? $last_user->display_name : __('Somebody');
@ -93,6 +95,7 @@ case 'edit':
wp_set_post_lock( $post->ID ); wp_set_post_lock( $post->ID );
wp_enqueue_script('autosave'); wp_enqueue_script('autosave');
} }
}
require_once('admin-header.php'); require_once('admin-header.php');

View File

@ -90,6 +90,8 @@ 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 ( current_user_can('edit_post', $post_ID) ) {
if ( $last = wp_check_post_lock( $post->ID ) ) { if ( $last = wp_check_post_lock( $post->ID ) ) {
$last_user = get_userdata( $last ); $last_user = get_userdata( $last );
$last_user_name = $last_user ? $last_user->display_name : __('Somebody'); $last_user_name = $last_user ? $last_user->display_name : __('Somebody');
@ -100,6 +102,7 @@ case 'edit':
wp_set_post_lock( $post->ID ); wp_set_post_lock( $post->ID );
wp_enqueue_script('autosave'); wp_enqueue_script('autosave');
} }
}
require_once('admin-header.php'); require_once('admin-header.php');