From 0afafb7a1b3f19494244605797166086a8369fca Mon Sep 17 00:00:00 2001 From: Sergey Biryukov Date: Wed, 18 Oct 2017 21:12:51 +0000 Subject: [PATCH] I18N: Unify error messages in XML-RPC methods `wp_deleteCategory()` and `wp_deleteComment()`. Props ramiy. Fixes #39019. Built from https://develop.svn.wordpress.org/trunk@41927 git-svn-id: http://core.svn.wordpress.org/trunk@41761 1a063a9b-81f0-0310-95a4-ce76da25c4cd --- wp-includes/class-wp-xmlrpc-server.php | 14 ++++++++------ wp-includes/version.php | 2 +- 2 files changed, 9 insertions(+), 7 deletions(-) diff --git a/wp-includes/class-wp-xmlrpc-server.php b/wp-includes/class-wp-xmlrpc-server.php index ee04cc0c1d..52d2d4e807 100644 --- a/wp-includes/class-wp-xmlrpc-server.php +++ b/wp-includes/class-wp-xmlrpc-server.php @@ -3137,8 +3137,9 @@ class wp_xmlrpc_server extends IXR_Server { do_action( 'xmlrpc_call', 'wp.newCategory' ); // Make sure the user is allowed to add a category. - if ( !current_user_can('manage_categories') ) - return new IXR_Error(401, __('Sorry, you are not allowed to add a category.')); + if ( ! current_user_can( 'manage_categories' ) ) { + return new IXR_Error( 401, __( 'Sorry, you are not allowed to add a category.' ) ); + } // If no slug was provided make it empty so that // WordPress will generate one. @@ -3212,8 +3213,9 @@ class wp_xmlrpc_server extends IXR_Server { /** This action is documented in wp-includes/class-wp-xmlrpc-server.php */ do_action( 'xmlrpc_call', 'wp.deleteCategory' ); - if ( !current_user_can('manage_categories') ) - return new IXR_Error( 401, __( 'Sorry, you are not allowed to delete a category.' ) ); + if ( ! current_user_can( 'delete_term', $category_id ) ) { + return new IXR_Error( 401, __( 'Sorry, you are not allowed to delete this category.' ) ); + } $status = wp_delete_term( $category_id, 'category' ); @@ -3442,8 +3444,8 @@ class wp_xmlrpc_server extends IXR_Server { return new IXR_Error( 404, __( 'Invalid comment ID.' ) ); } - if ( !current_user_can( 'edit_comment', $comment_ID ) ) { - return new IXR_Error( 403, __( 'Sorry, you are not allowed to moderate or edit this comment.' ) ); + if ( ! current_user_can( 'edit_comment', $comment_ID ) ) { + return new IXR_Error( 403, __( 'Sorry, you are not allowed to delete this comment.' ) ); } /** This action is documented in wp-includes/class-wp-xmlrpc-server.php */ diff --git a/wp-includes/version.php b/wp-includes/version.php index 18f099b465..4d9c785c1f 100644 --- a/wp-includes/version.php +++ b/wp-includes/version.php @@ -4,7 +4,7 @@ * * @global string $wp_version */ -$wp_version = '4.9-beta2-41926'; +$wp_version = '4.9-beta2-41927'; /** * Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.