_admin_notice_post_locked

Definition:
function _admin_notice_post_locked() {}

Outputs the notice message to say that someone else is editing this post at the moment.

Source code

function _admin_notice_post_locked() {

	global $post;



	$lock = explode( ':', get_post_meta( $post->ID, '_edit_lock', true ) );

	$user = isset( $lock[1] ) ? $lock[1] : get_post_meta( $post->ID, '_edit_last', true );

	$last_user = get_userdata( $user );

	$last_user_name = $last_user ? $last_user->display_name : __('Somebody');



	switch ($post->post_type) {

		case 'post':

			$message = __( 'Warning: %s is currently editing this post' );

			break;

		case 'page':

			$message = __( 'Warning: %s is currently editing this page' );

			break;

		default:

			$message = __( 'Warning: %s is currently editing this.' );

	}



	$message = sprintf( $message, esc_html( $last_user_name ) );

	echo "<div class='error'><p>$message</p></div>";

}

4295

No comments yet... Be the first to leave a reply!

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

%d bloggers like this: