| @@ 686-688 (lines=3) @@ | ||
| 683 | ||
| 684 | $id = $comment->comment_ID; |
|
| 685 | ||
| 686 | if ( isset( $request['type'] ) && get_comment_type( $id ) !== $request['type'] ) { |
|
| 687 | return new WP_Error( 'rest_comment_invalid_type', __( 'Sorry, you are not allowed to change the comment type.' ), array( 'status' => 404 ) ); |
|
| 688 | } |
|
| 689 | ||
| 690 | $prepared_args = $this->prepare_item_for_database( $request ); |
|
| 691 | ||
| @@ 715-717 (lines=3) @@ | ||
| 712 | return $prepared_args; |
|
| 713 | } |
|
| 714 | ||
| 715 | if ( isset( $prepared_args['comment_content'] ) && empty( $prepared_args['comment_content'] ) ) { |
|
| 716 | return new WP_Error( 'rest_comment_content_invalid', __( 'Invalid comment content.' ), array( 'status' => 400 ) ); |
|
| 717 | } |
|
| 718 | ||
| 719 | $prepared_args['comment_ID'] = $id; |
|
| 720 | ||
| @@ 1044-1047 (lines=4) @@ | ||
| 1041 | ||
| 1042 | foreach ( $roles as $role ) { |
|
| 1043 | ||
| 1044 | if ( ! isset( $wp_roles->role_objects[ $role ] ) ) { |
|
| 1045 | /* translators: %s: role key */ |
|
| 1046 | return new WP_Error( 'rest_user_invalid_role', sprintf( __( 'The role %s does not exist.' ), $role ), array( 'status' => 400 ) ); |
|
| 1047 | } |
|
| 1048 | ||
| 1049 | $potential_role = $wp_roles->role_objects[ $role ]; |
|
| 1050 | ||