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: http://svn.automattic.com/wordpress/trunk@14585 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
@@ -793,7 +793,7 @@ function get_edit_post_link( $id = 0, $context = 'display' ) {
|
||||
if ( !$post_type_object )
|
||||
return;
|
||||
|
||||
if ( !current_user_can( $post_type_object->edit_cap, $post->ID ) )
|
||||
if ( !current_user_can( $post_type_object->cap->edit_post, $post->ID ) )
|
||||
return;
|
||||
|
||||
return apply_filters( 'get_edit_post_link', admin_url( sprintf($post_type_object->_edit_link . $action, $post->ID) ), $post->ID, $context );
|
||||
@@ -846,7 +846,7 @@ function get_delete_post_link( $id = 0, $deprecated = '', $force_delete = false
|
||||
if ( !$post_type_object )
|
||||
return;
|
||||
|
||||
if ( !current_user_can( $post_type_object->delete_cap, $post->ID ) )
|
||||
if ( !current_user_can( $post_type_object->cap->delete_post, $post->ID ) )
|
||||
return;
|
||||
|
||||
$action = ( $force_delete || !EMPTY_TRASH_DAYS ) ? 'delete' : 'trash';
|
||||
|
||||
Reference in New Issue
Block a user