WordPress.org

Make WordPress Core

Ticket #38822: 38822.2.diff

File 38822.2.diff, 1.6 KB (added by danielbachhuber, 4 years ago)
  • src/wp-includes/rest-api/endpoints/class-wp-rest-comments-controller.php

    diff --git a/src/wp-includes/rest-api/endpoints/class-wp-rest-comments-controller.php b/src/wp-includes/rest-api/endpoints/class-wp-rest-comments-controller.php
    index bfa3159..e4e1be4 100644
    a b class WP_REST_Comments_Controller extends WP_REST_Controller { 
    373373
    374374                // Limit who can set comment `author` or `status` to anything other than the default.
    375375                if ( isset( $request['author'] ) && get_current_user_id() !== $request['author'] && ! current_user_can( 'moderate_comments' ) ) {
    376                         return new WP_Error( 'rest_comment_invalid_author', __( 'Comment author invalid.' ), array( 'status' => rest_authorization_required_code() ) );
     376                        /* translators: %s: request parameter */
     377                        return new WP_Error( 'rest_comment_invalid_author', sprintf( __( "Sorry, you are not allowed to edit '%s' for comments." ), 'author' ), array( 'status' => rest_authorization_required_code() ) );
    377378                }
    378379
    379380                if ( isset( $request['status'] ) && ! current_user_can( 'moderate_comments' ) ) {
    380                         return new WP_Error( 'rest_comment_invalid_status', __( 'Sorry, you are not allowed to set status for comments.' ), array( 'status' => rest_authorization_required_code() ) );
     381                        /* translators: %s: request parameter */
     382                        return new WP_Error( 'rest_comment_invalid_status', sprintf( __( "Sorry, you are not allowed to edit '%s' for comments." ), 'status' ), array( 'status' => rest_authorization_required_code() ) );
    381383                }
    382384
    383385                if ( empty( $request['post'] ) ) {