Switch the post|page being editing message from a create_function call to a normal function and reduce the duplicated code. See #10729.

git-svn-id: http://svn.automattic.com/wordpress/trunk@11923 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
westi
2009-09-13 08:52:39 +00:00
parent 4cb6db8467
commit 2561a6bb45
3 changed files with 17 additions and 10 deletions

View File

@@ -108,11 +108,7 @@ case 'edit':
wp_enqueue_script('word-count');
if ( $last = wp_check_post_lock( $post->ID ) ) {
$last_user = get_userdata( $last );
$last_user_name = $last_user ? $last_user->display_name : __('Somebody');
$message = sprintf( __( 'Warning: %s is currently editing this page' ), esc_html( $last_user_name ) );
$message = str_replace( "'", "\'", "<div class='error'><p>$message</p></div>" );
add_action('admin_notices', create_function( '', "echo '$message';" ) );
add_action('admin_notices', '_admin_notice_post_locked' );
} else {
wp_set_post_lock( $post->ID );
wp_enqueue_script('autosave');