Ticket #38822: 38822.patch
| File 38822.patch, 2.1 KB (added by , 9 years ago) |
|---|
-
src/wp-includes/rest-api/endpoints/class-wp-rest-comments-controller.php
374 374 375 375 // Limit who can set comment `author`, `karma` or `status` to anything other than the default. 376 376 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() ) ); 378 379 } 379 380 380 381 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() ) ); 382 384 } 383 385 384 386 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() ) ); 386 389 } 387 390 388 391 if ( empty( $request['post'] ) && ! current_user_can( 'moderate_comments' ) ) {