WordPress.org

Make WordPress Core

Ticket #38822: 38822.patch

File 38822.patch, 2.1 KB (added by ocean90, 4 years ago)
  • src/wp-includes/rest-api/endpoints/class-wp-rest-comments-controller.php

     
    374374
    375375                // Limit who can set comment `author`, `karma` or `status` to anything other than the default.
    376376                if ( isset( $request['author'] ) && get_current_user_id() !== $request['author'] && ! current_user_can( 'moderate_comments' ) ) {
    377                         return new WP_Error( 'rest_comment_invalid_author', __( 'Comment author invalid.' ), array( 'status' => rest_authorization_required_code() ) );
     377                        /* translators: %s: request parameter */
     378                        return new WP_Error( 'rest_comment_invalid_author', sprintf( __( "Sorry, you are not allowed to set '%s' for comments." ), 'author' ), array( 'status' => rest_authorization_required_code() ) );
    378379                }
    379380
    380381                if ( isset( $request['karma'] ) && $request['karma'] > 0 && ! current_user_can( 'moderate_comments' ) ) {
    381                         return new WP_Error( 'rest_comment_invalid_karma', __( 'Sorry, you are not allowed to set karma for comments.' ), array( 'status' => rest_authorization_required_code() ) );
     382                        /* translators: %s: request parameter */
     383                        return new WP_Error( 'rest_comment_invalid_karma', sprintf( __( "Sorry, you are not allowed to set '%s' for comments." ), 'karma' ), array( 'status' => rest_authorization_required_code() ) );
    382384                }
    383385
    384386                if ( isset( $request['status'] ) && ! current_user_can( 'moderate_comments' ) ) {
    385                         return new WP_Error( 'rest_comment_invalid_status', __( 'Sorry, you are not allowed to set status for comments.' ), array( 'status' => rest_authorization_required_code() ) );
     387                        /* translators: %s: request parameter */
     388                        return new WP_Error( 'rest_comment_invalid_status', sprintf( __( "Sorry, you are not allowed to set '%s' for comments." ), 'status' ), array( 'status' => rest_authorization_required_code() ) );
    386389                }
    387390
    388391                if ( empty( $request['post'] ) && ! current_user_can( 'moderate_comments' ) ) {