I18N: Unify error messages in XML-RPC methods `wp_deleteCategory()` and `wp_deleteComment()`.

Props ramiy.
Fixes #39019.

git-svn-id: https://develop.svn.wordpress.org/trunk@41927 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
Sergey Biryukov 2017-10-18 21:11:47 +00:00
parent ac8bc46b09
commit 6426b0b400
1 changed files with 8 additions and 6 deletions

View File

@ -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 */