Yes, there is a function in WP for that: wp_check_post_lock()
Give it the post ID and it will return the user ID that is currently editing the post OR false if no one is editing the post (i.e. it is not locked).
$is_locked = wp_check_post_lock( $post_id );
if ( false === $is_locked ) {
// Post $post_id is not not locked for editing
} else {
// Post is not locked, $is_locked contains the user ID who is editing.
$user = get_user_by( 'id', $is_locked );
echo 'Post id being edited by ' . $user->user_login;
}
Related Posts:
- Custom user profile, registration, login page with theme
- How do I create a custom role capability?
- How to check username/password without signing in the user
- Add Custom User Capabilities Before or After the Custom User Role has Been Added?
- WordPress REST API call generates nonce twice on every call
- How to use WP default post list tables in a plugin?
- How to add quick edit and bulk edit fields to users admin section
- Why is the reset password key missing in the reset password email?
- Generating User(s) with Settings API
- WordPress admin deleted user details not removed in database. How to delete WordPress Users from Database
- Print WordPress username id inside JavaScript
- Function Get User Object By Username?
- How to get the ID of the currently logged in user?
- Modify users.php page to create page/post on button clicked
- Subscribe to author?
- How to filter users list on user_status field with get_users()
- Frontend language per user
- Display custom fields in frontside user profile
- How to restrict access to image folder depending on whether product is purchased or not?
- global $current_user not current user
- Display list of uploaded images, filtered by user under a specific user group
- What is the proper way to get logged in user id in a plugin?
- How to build a fool proof AdSense revenue sharing model?
- Hide custom post type by user roles
- How do I have now a duplicated user entry if this is not allowed (and I cannot replicate it)?
- How to allow only two (or more) users access to a plugin
- How can I create a custom plugin that allows anonymous users to signup without registering?
- First and last name fields not filled when using wp_insert_user
- Wp-admin Custom User Management
- get author of published post
- How to get custom post_author?
- Associate multiple email addresses with the same user account, so they can log in with either
- Update a user profile via frontend
- Best practice for Designing a Plugin with this scenario
- Adding another field to user table
- how to get the top 10 popular blogs
- How can I change my assigned user role in WordPress 3.5.1?
- How to relate the Category to user?
- User Data Handling between two plugins
- Adding a dropdown on the user admin
- Allowing duplicating users with same user_login and user_email
- Why User_login key doesn’t work with wp_update_user()
- How to grab data after wp user search is complete
- How to prevent users from deleting their accounts?
- User Registration Moderate
- How to retrieve custom profile fields associated with different users
- Upgrade routine: Interaction with user confirmation
- How do I control the list of Pages an author can see?
- Multiple Users Logged In Causing Incorrect Account Returned
- first_name property missing inside register_user action hook
- user can login from single account detail from multiple locations(computer) at the same time [closed]
- Create Unique and Customized User ID for Website Members in WordPress
- Get logged in user with – custom plugin
- Plugin architecture to pull from API & create dynamic content on WP site?
- Undefined is_user_logged_in() error with Plugin Query code
- Add code to template dynamically
- Thickbox in Plugin settings page?
- Plugin Options not saving options and doesn’t work
- How to localize data array in plugin’s option page
- Plugin admin page stylesheet doesn’t work
- How To Protect Plugin Display From Being Affected By Theme’s CSS
- How to remove/replace current page template?
- WordPress dynamic widget by location?
- wp login redirect loop reauth=1
- How do I add a menu item to a Pods admin menu?
- How to share user data across multiple WordPress websites?
- sanitizing/escaping plugin options
- Bootstrap Error in WordPress plugin
- Update plugin settings option_name for big plugin update
- Load stylesheet in edit category page?
- What could cause a WP Option to get truncated?
- Plugin to create Posts and Forums then choose category and parent forum
- $wpdb->update Issue
- Checking for existing title in custom db query not working
- Borrowing of Previously Translated Strings by Child Plugin
- Enqueue scripts inside a class in a plugin
- Adding filter to the title without affecting the menu title
- Redirect User to custom URL after registering
- Load php file with jquery in single.php
- Listing wordpress users with a search function
- Is there anything special required to make a plugin work in a multisite environment?
- Restrict certain actions to plugin-specific admin menu pages only
- How to validate inputs with filter in register_setting callback
- WordPress Page Reload Takes forever during theme development
- Cannot stop wpautop from messing up my plug-in output
- How to get post meta in functions?
- Enqueue ONLY Plugin Styles and Scripts
- Plugin’s total number of users
- How to edit wp-signup.php content using plugin
- How to Find a Gallery’s ID
- How to close tinymce inline popup
- AJAX request not routing through proxy
- How can I prevent ‘500 internal server error’ because of a long install process?
- My plugin won’t create table in wordpress 3.5
- Remove Permalink Meta Box not working?
- How do i remove the title from a specific page
- Can / should a widget plugin define its own Widget Area?
- WordPress actions for plugin admin UI page
- How to get changed post title in my custom plug-in which fires when ‘save_post’ is called?
- wp_insert_user keeps echoing values