WordPress.org

Make WordPress Core

Ticket #38803: 38803.2.patch

File 38803.2.patch, 2.0 KB (added by ramiy, 4 years ago)
  • wp-includes/rest-api/endpoints/class-wp-rest-comments-controller.php

     
    109109                                $post = get_post( $post_id );
    110110
    111111                                if ( ! empty( $post_id ) && $post && ! $this->check_read_post_permission( $post ) ) {
    112                                         return new WP_Error( 'rest_cannot_read_post', __( 'Sorry, you cannot read the post for this comment.' ), array( 'status' => rest_authorization_required_code() ) );
     112                                        return new WP_Error( 'rest_cannot_read_post', __( 'Sorry, you are not allowed to read the post for this comment.' ), array( 'status' => rest_authorization_required_code() ) );
    113113                                } elseif ( 0 === $post_id && ! current_user_can( 'moderate_comments' ) ) {
    114114                                        return new WP_Error( 'rest_cannot_read', __( 'Sorry, you are not allowed to read comments without a post.' ), array( 'status' => rest_authorization_required_code() ) );
    115115                                }
     
    399399                        }
    400400
    401401                        if ( ! $this->check_read_post_permission( $post ) ) {
    402                                 return new WP_Error( 'rest_cannot_read_post', __( 'Sorry, you cannot read the post for this comment.' ), array( 'status' => rest_authorization_required_code() ) );
     402                                return new WP_Error( 'rest_cannot_read_post', __( 'Sorry, you are not allowed to read the post for this comment.' ), array( 'status' => rest_authorization_required_code() ) );
    403403                        }
    404404
    405405                        if ( ! comments_open( $post->ID ) ) {
     
    615615                }
    616616
    617617                if ( isset( $request['type'] ) && get_comment_type( $id ) !== $request['type'] ) {
    618                         return new WP_Error( 'rest_comment_invalid_type', __( 'Sorry, you cannot change the comment type.' ), array( 'status' => 404 ) );
     618                        return new WP_Error( 'rest_comment_invalid_type', __( 'Sorry, you are not allowed to change the comment type.' ), array( 'status' => 404 ) );
    619619                }
    620620
    621621                $prepared_args = $this->prepare_item_for_database( $request );