- Timestamp:
- 11/15/2016 10:22:33 PM (8 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/wp-includes/rest-api/endpoints/class-wp-rest-comments-controller.php
r39252 r39257 112 112 return new WP_Error( 'rest_cannot_read_post', __( 'Sorry, you cannot read the post for this comment.' ), array( 'status' => rest_authorization_required_code() ) ); 113 113 } elseif ( 0 === $post_id && ! current_user_can( 'moderate_comments' ) ) { 114 return new WP_Error( 'rest_cannot_read', __( 'Sorry, you cannotread comments without a post.' ), array( 'status' => rest_authorization_required_code() ) );114 return new WP_Error( 'rest_cannot_read', __( 'Sorry, you are not allowed to read comments without a post.' ), array( 'status' => rest_authorization_required_code() ) ); 115 115 } 116 116 } … … 118 118 119 119 if ( ! empty( $request['context'] ) && 'edit' === $request['context'] && ! current_user_can( 'moderate_comments' ) ) { 120 return new WP_Error( 'rest_forbidden_context', __( 'Sorry, you cannotview comments with edit context.' ), array( 'status' => rest_authorization_required_code() ) );120 return new WP_Error( 'rest_forbidden_context', __( 'Sorry, you are not allowed to view comments with edit context.' ), array( 'status' => rest_authorization_required_code() ) ); 121 121 } 122 122 … … 312 312 313 313 if ( ! $this->check_read_permission( $comment ) ) { 314 return new WP_Error( 'rest_cannot_read', __( 'Sorry, you cannotread this comment.' ), array( 'status' => rest_authorization_required_code() ) );314 return new WP_Error( 'rest_cannot_read', __( 'Sorry, you are not allowed to read this comment.' ), array( 'status' => rest_authorization_required_code() ) ); 315 315 } 316 316 … … 318 318 319 319 if ( $post && ! $this->check_read_post_permission( $post ) ) { 320 return new WP_Error( 'rest_cannot_read_post', __( 'Sorry, you cannotread the post for this comment.' ), array( 'status' => rest_authorization_required_code() ) );320 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() ) ); 321 321 } 322 322 323 323 if ( ! empty( $request['context'] ) && 'edit' === $request['context'] && ! current_user_can( 'moderate_comments' ) ) { 324 return new WP_Error( 'rest_forbidden_context', __( 'Sorry, you cannotview this comment with edit context.' ), array( 'status' => rest_authorization_required_code() ) );324 return new WP_Error( 'rest_forbidden_context', __( 'Sorry, you are not allowed to view this comment with edit context.' ), array( 'status' => rest_authorization_required_code() ) ); 325 325 } 326 326 … … 379 379 380 380 if ( isset( $request['karma'] ) && $request['karma'] > 0 && ! current_user_can( 'moderate_comments' ) ) { 381 return new WP_Error( 'rest_comment_invalid_karma', __( 'Sorry, you cannotset karma for comments.' ), array( 'status' => rest_authorization_required_code() ) );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 382 } 383 383 384 384 if ( isset( $request['status'] ) && ! current_user_can( 'moderate_comments' ) ) { 385 return new WP_Error( 'rest_comment_invalid_status', __( 'Sorry, you cannotset status for comments.' ), array( 'status' => rest_authorization_required_code() ) );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() ) ); 386 386 } 387 387 388 388 if ( empty( $request['post'] ) && ! current_user_can( 'moderate_comments' ) ) { 389 return new WP_Error( 'rest_comment_invalid_post_id', __( 'Sorry, you cannotcreate this comment without a post.' ), array( 'status' => rest_authorization_required_code() ) );389 return new WP_Error( 'rest_comment_invalid_post_id', __( 'Sorry, you are not allowed to create this comment without a post.' ), array( 'status' => rest_authorization_required_code() ) ); 390 390 } 391 391 392 392 if ( ! empty( $request['post'] ) && $post = get_post( (int) $request['post'] ) ) { 393 393 if ( 'draft' === $post->post_status ) { 394 return new WP_Error( 'rest_comment_draft_post', __( 'Sorry, you cannotcreate a comment on this post.' ), array( 'status' => 403 ) );394 return new WP_Error( 'rest_comment_draft_post', __( 'Sorry, you are not allowed to create a comment on this post.' ), array( 'status' => 403 ) ); 395 395 } 396 396 397 397 if ( 'trash' === $post->post_status ) { 398 return new WP_Error( 'rest_comment_trash_post', __( 'Sorry, you cannotcreate a comment on this post.' ), array( 'status' => 403 ) );398 return new WP_Error( 'rest_comment_trash_post', __( 'Sorry, you are not allowed to create a comment on this post.' ), array( 'status' => 403 ) ); 399 399 } 400 400
Note: See TracChangeset
for help on using the changeset viewer.