[wp-trac] [WordPress Trac] #16714: Introduce capabilities for adding new posts
WordPress Trac
wp-trac at lists.automattic.com
Wed Sep 26 00:11:42 UTC 2012
#16714: Introduce capabilities for adding new posts
-----------------------------+-----------------------
Reporter: nacin | Owner: casben79
Type: enhancement | Status: accepted
Priority: normal | Milestone: 3.5
Component: Role/Capability | Version:
Severity: normal | Resolution:
Keywords: has-patch |
-----------------------------+-----------------------
Comment (by nacin):
[attachment:16714.2.diff] has some problems in map_meta_cap(). Rather than
mapping to 'edit_posts', it should map to
`post_type_object->cap->edit_posts`.
Bonus: It should instead map to `cap->create_posts`, and in
get_post_type_capabilities(), `cap->create_posts` should be set to
`'edit_' . $plural_base` by default, essentially mapping it on the fly to
edit_posts.
Both of these work only if we know the post type. So, we'll probably need
to clarify that this can only be used like this:
`if ( current_user_can( 'create_post', $post_type )` (or 'create_posts').
If used directly, as in $post_type_object->cap->create_posts, then
$post_type isn't necessary. Attached is my thought process so far.
--
Ticket URL: <http://core.trac.wordpress.org/ticket/16714#comment:25>
WordPress Trac <http://core.trac.wordpress.org/>
WordPress blogging software
More information about the wp-trac
mailing list