From b136b074bfeeb7d7b3fe9ccdcd56016533791fee Mon Sep 17 00:00:00 2001 From: Sergey Biryukov Date: Wed, 2 Sep 2015 18:15:20 +0000 Subject: [PATCH] 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 --- wp-admin/edit.php | 9 +++++++-- wp-includes/class-wp-xmlrpc-server.php | 2 +- wp-includes/version.php | 2 +- 3 files changed, 9 insertions(+), 4 deletions(-) diff --git a/wp-admin/edit.php b/wp-admin/edit.php index c9ef3b57cd..782b61dc42 100644 --- a/wp-admin/edit.php +++ b/wp-admin/edit.php @@ -30,8 +30,13 @@ $post_type_object = get_post_type_object( $post_type ); if ( ! $post_type_object ) wp_die( __( 'Invalid post type' ) ); -if ( ! current_user_can( $post_type_object->cap->edit_posts ) ) - wp_die( __( 'Cheatin’ uh?' ), 403 ); +if ( ! current_user_can( $post_type_object->cap->edit_posts ) ) { + wp_die( + '

' . __( 'Cheatin’ uh?' ) . '

' . + '

' . __( 'You are not allowed to edit posts in this post type.' ) . '

', + 403 + ); +} $wp_list_table = _get_list_table('WP_Posts_List_Table'); $pagenum = $wp_list_table->get_pagenum(); diff --git a/wp-includes/class-wp-xmlrpc-server.php b/wp-includes/class-wp-xmlrpc-server.php index 1c3a93a265..7108ff0a7b 100644 --- a/wp-includes/class-wp-xmlrpc-server.php +++ b/wp-includes/class-wp-xmlrpc-server.php @@ -1733,7 +1733,7 @@ class wp_xmlrpc_server extends IXR_Server { } 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; diff --git a/wp-includes/version.php b/wp-includes/version.php index 41306e967d..854575fd0a 100644 --- a/wp-includes/version.php +++ b/wp-includes/version.php @@ -4,7 +4,7 @@ * * @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.