Use meta caps edit_post, read_post, and delete_post directly, rather than consulting the post type object. map_meta_cap() handles that for us. props markjaquith, kovshenin. fixes #23226.

git-svn-id: https://develop.svn.wordpress.org/trunk@24593 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
Andrew Nacin
2013-07-08 20:05:42 +00:00
parent e16dca6fc9
commit f3b332e9bb
12 changed files with 28 additions and 37 deletions

View File

@@ -139,7 +139,7 @@ case 'edit':
if ( ! $post_type_object )
wp_die( __( 'Unknown post type.' ) );
if ( ! current_user_can( $post_type_object->cap->edit_post, $post_id ) )
if ( ! current_user_can( 'edit_post', $post_id ) )
wp_die( __( 'You are not allowed to edit this item.' ) );
if ( 'trash' == $post->post_status )
@@ -235,7 +235,7 @@ case 'trash':
if ( ! $post_type_object )
wp_die( __( 'Unknown post type.' ) );
if ( ! current_user_can( $post_type_object->cap->delete_post, $post_id ) )
if ( ! current_user_can( 'delete_post', $post_id ) )
wp_die( __( 'You are not allowed to move this item to the Trash.' ) );
if ( $user_id = wp_check_post_lock( $post_id ) ) {
@@ -259,7 +259,7 @@ case 'untrash':
if ( ! $post_type_object )
wp_die( __( 'Unknown post type.' ) );
if ( ! current_user_can( $post_type_object->cap->delete_post, $post_id ) )
if ( ! current_user_can( 'delete_post', $post_id ) )
wp_die( __( 'You are not allowed to move this item out of the Trash.' ) );
if ( ! wp_untrash_post( $post_id ) )
@@ -278,7 +278,7 @@ case 'delete':
if ( ! $post_type_object )
wp_die( __( 'Unknown post type.' ) );
if ( ! current_user_can( $post_type_object->cap->delete_post, $post_id ) )
if ( ! current_user_can( 'delete_post', $post_id ) )
wp_die( __( 'You are not allowed to delete this item.' ) );
$force = ! EMPTY_TRASH_DAYS;