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:
@@ -152,7 +152,7 @@ case 'edit':
|
||||
if ( empty($post->ID) )
|
||||
wp_die( __('You attempted to edit an item that doesn’t exist. Perhaps it was deleted?') );
|
||||
|
||||
if ( !current_user_can($post_type_object->edit_cap, $post_id) )
|
||||
if ( !current_user_can($post_type_object->cap->edit_post, $post_id) )
|
||||
wp_die( __('You are not allowed to edit this item.') );
|
||||
|
||||
if ( 'trash' == $post->post_status )
|
||||
@@ -217,7 +217,7 @@ case 'trash':
|
||||
|
||||
$post = & get_post($post_id);
|
||||
|
||||
if ( !current_user_can($post_type_object->delete_cap, $post_id) )
|
||||
if ( !current_user_can($post_type_object->cap->delete_post, $post_id) )
|
||||
wp_die( __('You are not allowed to move this item to the Trash.') );
|
||||
|
||||
if ( ! wp_trash_post($post_id) )
|
||||
@@ -230,7 +230,7 @@ case 'trash':
|
||||
case 'untrash':
|
||||
check_admin_referer('untrash-' . $post_type . '_' . $post_id);
|
||||
|
||||
if ( !current_user_can($post_type_object->delete_cap, $post_id) )
|
||||
if ( !current_user_can($post_type_object->cap->delete_post, $post_id) )
|
||||
wp_die( __('You are not allowed to move this item out of the Trash.') );
|
||||
|
||||
if ( ! wp_untrash_post($post_id) )
|
||||
@@ -243,7 +243,7 @@ case 'untrash':
|
||||
case 'delete':
|
||||
check_admin_referer('delete-' . $post_type . '_' . $post_id);
|
||||
|
||||
if ( !current_user_can($post_type_object->delete_cap, $post_id) )
|
||||
if ( !current_user_can($post_type_object->cap->delete_post, $post_id) )
|
||||
wp_die( __('You are not allowed to delete this item.') );
|
||||
|
||||
$force = !EMPTY_TRASH_DAYS;
|
||||
|
||||
Reference in New Issue
Block a user