Opened 11 years ago
Last modified 6 years ago
#24572 new enhancement
Should be able to unlock a post outside of ajax handler
Reported by: | bbrooks | Owned by: | |
---|---|---|---|
Milestone: | Priority: | normal | |
Severity: | normal | Version: | |
Component: | Posts, Post Types | Keywords: | needs-patch dev-feedback |
Focuses: | administration | Cc: |
Description
Right now you can programmatically lock a post for editing using wp_set_post_lock, but you can't unlock it in a similar fashion. The only unlocking code is found in the ajax handler wp_ajax_wp_remove_post_lock.
I've created a function wp_unset_post_lock in the style of wp_set_post_lock that unlocks a post with a given ID. I've also refactored wp_ajax_wp_remove_post_lock to use this function.
The only resulting difference is that we use the current user's ID instead of the one supplied in the ajax call, but since we're unlocking the post instead of locking it, it doesn't really matter who's ID is in the meta.
This change was requested by Joey Kudish of the VIP team.
Attachments (2)
Change History (11)
#3
@
11 years ago
- Cc batmoo@… johnjamesjacoby removed
- Keywords do-not-punt added
- Milestone changed from Awaiting Review to 3.6
This is a very good idea.
I am not sure if "unset" is the right word. "remove" or "release", maybe?
#5
@
11 years ago
Yeah, the function is hard to name because honestly the whole logic of unlocking posts is less-than-intuitive. To unlock a post, you merely set the lock to a time in the past almost as long as the 'timeout due to inactivity' criteria in the lock mechanism.
That said, 'expire' might be a better verb. How about "wp_expire_post_lock"?
If, however, we're not concerned with the name reflecting the mechanism, it should really just be wp_lock_post and wp_unlock_post.
#7
@
11 years ago
- Keywords do-not-punt removed
- Milestone changed from 3.6 to Future Release
After some discussion in IRC, this doesn't actually make sense as a 1:1 handler => API change. Let's punt this and re-consider soon.
If necessary, you can unconditionally clear a lock by removing _edit_lock.
New post unlocking function and refactor of an ajax handler to use new function