Make WordPress Core


Ignore:
Timestamp:
10/18/2017 09:11:47 PM (7 years ago)
Author:
SergeyBiryukov
Message:

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

Props ramiy.
Fixes #39019.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-includes/class-wp-xmlrpc-server.php

    r41574 r41927  
    31383138
    31393139        // Make sure the user is allowed to add a category.
    3140         if ( !current_user_can('manage_categories') )
    3141             return new IXR_Error(401, __('Sorry, you are not allowed to add a category.'));
     3140        if ( ! current_user_can( 'manage_categories' ) ) {
     3141            return new IXR_Error( 401, __( 'Sorry, you are not allowed to add a category.' ) );
     3142        }
    31423143
    31433144        // If no slug was provided make it empty so that
     
    32133214        do_action( 'xmlrpc_call', 'wp.deleteCategory' );
    32143215
    3215         if ( !current_user_can('manage_categories') )
    3216             return new IXR_Error( 401, __( 'Sorry, you are not allowed to delete a category.' ) );
     3216        if ( ! current_user_can( 'delete_term', $category_id ) ) {
     3217            return new IXR_Error( 401, __( 'Sorry, you are not allowed to delete this category.' ) );
     3218        }
    32173219
    32183220        $status = wp_delete_term( $category_id, 'category' );
     
    34433445        }
    34443446
    3445         if ( !current_user_can( 'edit_comment', $comment_ID ) ) {
    3446             return new IXR_Error( 403, __( 'Sorry, you are not allowed to moderate or edit this comment.' ) );
     3447        if ( ! current_user_can( 'edit_comment', $comment_ID ) ) {
     3448            return new IXR_Error( 403, __( 'Sorry, you are not allowed to delete this comment.' ) );
    34473449        }
    34483450
Note: See TracChangeset for help on using the changeset viewer.