Opened 9 years ago
Last modified 7 years ago
#33240 assigned enhancement
Introduce a capability for previewing posts
Reported by: | johnbillion | Owned by: | |
---|---|---|---|
Milestone: | Future Release | Priority: | normal |
Severity: | normal | Version: | |
Component: | Role/Capability | Keywords: | needs-patch, needs-unit-tests, granular-capabilities |
Focuses: | Cc: |
Description
In order to preview an unpublished post (ie. draft or pending), a user needs the edit_posts
capability for that post type (src).
There is a valid use case where a site requires a user role which has the capability to preview unpublished posts but not edit them, for example for editorial review/sign-off, layout review, early access, etc.
You can get around this by using a combination of the posts_results and the_posts filters, but this isn't very future-proof because the post results skip a bunch of logic that occurs between those two filters.
A preview_post
meta capability and a preview_posts
primitive capability could be introduced and implemented wherever the edit_posts
capability is used in regard to previewing unpublished posts. By default, it will simply map to the edit_posts
capability.
Thoughts?
Change History (8)
#2
in reply to:
↑ 1
@
9 years ago
Replying to morganestes:
I think this could definitely be useful, especially with publishing shops that may not want to rely on a plugin for their editorial flow.
For implementation, would this be a checkbox on the user's profile page that is set by someone with a specific (filterable) capability (read-only for everyone else, maybe?) or would it be enabled through a hook, or some other way I haven't thought of?
I think the most elegant way to do it would be to just give it to users who current have edit_posts
by default, along the lines of the sub-cap concept (see the customize
cap), thereby making it possible to programmatically remove the cap rather than add it.
#3
@
8 years ago
- Focuses administration removed
- Keywords dev-feedback removed
- Milestone changed from Awaiting Review to 4.7
- Owner set to johnbillion
- Status changed from new to assigned
#4
@
8 years ago
- Milestone changed from 4.7 to Future Release
- Owner johnbillion deleted
This turns out to be more complicated that it first seems.
After patching several places in core with a preview_post
capability check, I realised that previewing draft posts is a very different action to previewing changes to published posts, but they're both called previews.
We might need a collection of caps such as preview_published_posts
, preview_others_posts
, etc.
#6
@
8 years ago
@johnbillion Will you have time to tackle this again properly any time soon? It'd be a great feature for multi-user Wordpress installations everywhere.
I think this could definitely be useful, especially with publishing shops that may not want to rely on a plugin for their editorial flow.
For implementation, would this be a checkbox on the user's profile page that is set by someone with a specific (filterable) capability (read-only for everyone else, maybe?) or would it be enabled through a hook, or some other way I haven't thought of?