mirror of
https://github.com/gosticks/wordpress-develop.git
synced 2026-06-28 22:30:04 +00:00
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:
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user