Opened 10 years ago
Last modified 4 weeks ago
#38067 new enhancement
New filter `wp_post_lock_status`
| Reported by: | sebastian.pisula | Owned by: | |
|---|---|---|---|
| Priority: | normal | Milestone: | Future Release |
| Component: | Posts, Post Types | Version: | 2.5 |
| Severity: | normal | Keywords: | has-patch has-test-info needs-testing |
| Cc: | Focuses: |
Description
I have wp with one account for 5 people, employees. We make websites so 5 accounts for each website -> waste of time and difficult to maintain. We have big problem - if somebody edit page and I start edit the same page we have conficts and overwrite own changes. I can't see notice about that somebody edit this page because we use one account. My best idea! When user is logged in i create new cookie: wordpress_logged_in_unique_COOKIEHASH with unique hash -> user agent + wp_generate_password().
I save user hash if _edit_lock_hash was saved.
So I can't check that post is locked or. So I write filter for return value of wp_check_post_lock() and... this work!
I suggest add this filter (idea) to core or show me other way to resolve my problem.
Attachments (4)
Change History (14)
This ticket was mentioned in Slack in #core by sebastian.pisula. View the logs.
10 years ago
#3
@
7 years ago
- Keywords needs-refresh added
- Version → 2.5
He @sebastianpisula,
Thanks for this. Your filter request seems sensible. I do recommend using different user accounts, but I could see scenarios where a site would want to implement custom logic for post locking.
The patch needs a refresh against the latest trunk, though. Are you able to take care of that?
This ticket was mentioned in Slack in #core by sirlouen. View the logs.
11 months ago
This ticket was mentioned in PR #10306 on WordPress/wordpress-develop by @SirLouen.
11 months ago
#5
- Keywords needs-refresh removed
Trac ticket: https://core.trac.wordpress.org/ticket/38067
#6
@
11 months ago
- Keywords has-test-info needs-testing added
- Milestone Awaiting Review → Future Release
- Type feature request → enhancement
This hook has had no traction in 9 years. But I've been thinking on potential workarounds, and I can't think on a better workaround than this hook.
It's very ad-hoc though but after review, this patch should go in.
For testing Instructions, the ones provided by OP, he has provided a sample test plugin
This ticket was mentioned in Slack in #core-test by mohkatz. View the logs.
7 months ago
#9
@
5 weeks ago
- Keywords needs-unit-tests removed
I have written the requested unit tests for the wp_post_lock_status filter and attached them in 38067.diff.
@
4 weeks ago
WordPress block editor showing the post-lock takeover dialog for a draft locked by another user (Trac #38067).
#10
@
4 weeks ago
Tested in WordPress Playground (latest WordPress, PHP 8.3).
I reproduced the post-lock scenario in the block editor: a draft with a current _edit_lock owned by another user displays the “This post is already being edited” takeover dialog. Screenshot attached: attachment:trac-38067-post-lock-editor.png.
The native PR Previewer artifact for #10306 has expired, so I exercised the proposed wp_check_post_lock() logic in a fresh Playground endpoint. With a current lock owned by another user, the unfiltered result was that user's ID. A wp_post_lock_status callback received the lock status, post, lock time, time window, and user ID, and could override the result to false. Without a lock, the result remained false.
Functional result: pass.
Before merge, the linked PR should include the ticket's PHPUnit coverage and refresh the filter documentation: @since 4.7.0 is not appropriate for a new filter, and the summary should describe the filtered value. A fresh PR build artifact would also enable an exact-branch Playground retest.
![(please configure the [header_logo] section in trac.ini)](/chrome/site/your_project_logo.png)
if filter will be exists this is solution for my problem. I need only filter :)