[wp-trac] [WordPress Trac] #14122: Custom "capabilities" appears broken on custom post types
WordPress Trac
wp-trac at lists.automattic.com
Sat Nov 13 08:39:50 UTC 2010
#14122: Custom "capabilities" appears broken on custom post types
----------------------------+-----------------------------------------------
Reporter: jakemgold | Owner: nacin
Type: task (blessed) | Status: assigned
Priority: normal | Milestone: 3.1
Component: Post Types | Version: 3.0
Severity: normal | Keywords: needs-patch needs-unit-tests
----------------------------+-----------------------------------------------
Comment(by nacin):
Justifying 14122.capability_type.post.diff further:
In 3.0, per duck_ earlier in this ticket:
> If you use 'capabilities' => array( 'edit_posts' => 'edit_movies' ) then
map_meta_cap will see that $post_type->capability_type is equal to 'post'
and then decide that the edit_post maps to edit_posts.
Because we used strings in map_meta_cap until now, then if capabilities is
not empty, you should assume mapping did not work (without a filter).
Continuing:
> On the other hand, if you use 'capability_type' => 'movie' then
map_meta_cap will notice the difference and call itself again checking the
edit_movie meta-cap, however there is no matching case for this and so the
default is to return edit_movie as the capability required. (In the latter
case you could, as suggested, hook onto the map_meta_cap filter and check
if $cap == 'edit_movie' etc.)
Thus, capability_type = post && empty( capabilities ) means that mapping
should be triggered.
--
Ticket URL: <http://core.trac.wordpress.org/ticket/14122#comment:48>
WordPress Trac <http://core.trac.wordpress.org/>
WordPress blogging software
More information about the wp-trac
mailing list