Opened 10 years ago
Last modified 17 months ago
#38997 assigned defect (bug)
delete_private_posts capability doesn't prevent user from deleting private posts
| Reported by: | yboris | Owned by: | |
|---|---|---|---|
| Priority: | normal | Milestone: | Future Release |
| Component: | Role/Capability | Version: | 4.6.1 |
| Severity: | normal | Keywords: | has-patch has-unit-tests |
| Cc: | Focuses: | administration |
Description
Attempting to prevent users from deleting a published post works, but if they set a post to 'private' they can delete it even if 'delete_private_posts' capability is set to 0.
<?php global $current_user; // works $current_user->allcaps['delete_published_posts'] = 0; // doesn't work $current_user->allcaps['delete_private_posts'] = 0;
"doesn't work" means that "Trash" link appears on hover over the post in edit.php and "Move to Trash" shows up on post.php
Change History (5)
#2
@
9 years ago
- Component Users → Role/Capability
- Keywords needs-patch needs-unit-tests added
- Milestone Awaiting Review → Future Release
- Owner set to
- Status new → accepted
Thank you for your report, @yboris. Sorry that it's taken such a long time before anybody responded.
I'm looking into this as part of several other related fixes.
#4
@
18 months ago
I can reproduce the issue in version 6.7.1 as well. I’ve reviewed the codebase but couldn’t pinpoint the cause. I’ll continue investigating to find the root cause.
This ticket was mentioned in PR #8546 on WordPress/wordpress-develop by @sukhendu2002.
17 months ago
#5
- Keywords has-patch has-unit-tests added; needs-patch needs-unit-tests removed
Trac ticket: https://core.trac.wordpress.org/ticket/38997
![(please configure the [header_logo] section in trac.ini)](/chrome/site/your_project_logo.png)
The above "global $current_user" was a shorthand of: