Advertisements

wp_set_post_lock

Definition:
function wp_set_post_lock( $post_id ) {}

Mark the post as currently being edited by the current user

Parameters

  • int $post_id: ID of the post to being edited

Return values

returns:Returns false if the post doesn’t exist of there is no current user, or an array of the lock time and the user ID.

Source code

function wp_set_post_lock( $post_id ) {

	if ( !$post = get_post( $post_id ) )

		return false;

	if ( 0 == ($user_id = get_current_user_id()) )

		return false;



	$now = time();

	$lock = "$now:$user_id";



	update_post_meta( $post->ID, '_edit_lock', $lock );

}

4115

Advertisements

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 )

Twitter picture

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

Facebook photo

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

Google+ photo

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

Connecting to %s

%d bloggers like this: