Provide more helpful feedback than just "Cheatin' uh?" for permission errors in `wp-admin/edit.php`.

props ericlewis, kraftbj, lukecarbis, mrmist.
fixes #33671. see #14530.
Built from https://develop.svn.wordpress.org/trunk@33861


git-svn-id: http://core.svn.wordpress.org/trunk@33829 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
Sergey Biryukov 2015-09-02 18:15:20 +00:00
parent d2919e2d71
commit b136b074bf
3 changed files with 9 additions and 4 deletions

View File

@ -30,8 +30,13 @@ $post_type_object = get_post_type_object( $post_type );
if ( ! $post_type_object ) if ( ! $post_type_object )
wp_die( __( 'Invalid post type' ) ); wp_die( __( 'Invalid post type' ) );
if ( ! current_user_can( $post_type_object->cap->edit_posts ) ) if ( ! current_user_can( $post_type_object->cap->edit_posts ) ) {
wp_die( __( 'Cheatin’ uh?' ), 403 ); wp_die(
'<h1>' . __( 'Cheatin&#8217; uh?' ) . '</h1>' .
'<p>' . __( 'You are not allowed to edit posts in this post type.' ) . '</p>',
403
);
}
$wp_list_table = _get_list_table('WP_Posts_List_Table'); $wp_list_table = _get_list_table('WP_Posts_List_Table');
$pagenum = $wp_list_table->get_pagenum(); $pagenum = $wp_list_table->get_pagenum();

View File

@ -1733,7 +1733,7 @@ class wp_xmlrpc_server extends IXR_Server {
} }
if ( ! current_user_can( $post_type->cap->edit_posts ) ) if ( ! current_user_can( $post_type->cap->edit_posts ) )
return new IXR_Error( 401, __( 'Sorry, you are not allowed to edit posts in this post type' )); return new IXR_Error( 401, __( 'You are not allowed to edit posts in this post type.' ));
$query['post_type'] = $post_type->name; $query['post_type'] = $post_type->name;

View File

@ -4,7 +4,7 @@
* *
* @global string $wp_version * @global string $wp_version
*/ */
$wp_version = '4.4-alpha-33860'; $wp_version = '4.4-alpha-33861';
/** /**
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema. * Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.