Move post type object capabilities to a 'cap' object. Allow them to be initialized via the 'capabilities' key (an array) when registering support for the post type. Caps are now referred to by the name of the cap as if it was a post, i.e. ->cap->edit_post. see #13358.

git-svn-id: https://develop.svn.wordpress.org/trunk@14585 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
Andrew Nacin
2010-05-12 20:45:18 +00:00
parent 4b6c5c65c6
commit 323342deec
13 changed files with 86 additions and 73 deletions

View File

@@ -249,8 +249,8 @@ function get_editable_user_ids( $user_id, $exclude_zeros = true, $post_type = 'p
$user = new WP_User( $user_id );
$post_type_obj = get_post_type_object($post_type);
if ( ! $user->has_cap($post_type_obj->edit_others_cap) ) {
if ( $user->has_cap($post_type_obj->edit_type_cap) || ! $exclude_zeros )
if ( ! $user->has_cap($post_type_obj->cap->edit_other_posts) ) {
if ( $user->has_cap($post_type_obj->cap->edit_posts) || ! $exclude_zeros )
return array($user->id);
else
return array();