mirror of
https://github.com/WordPress/WordPress.git
synced 2025-02-17 03:56:07 +00:00
REST API: Unify some more permission error messages.
Props ramiy. Fixes #38803. Built from https://develop.svn.wordpress.org/trunk@39259 git-svn-id: http://core.svn.wordpress.org/trunk@39199 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
parent
a7af7c89a4
commit
74c9f82ef2
@ -109,7 +109,7 @@ class WP_REST_Comments_Controller extends WP_REST_Controller {
|
|||||||
$post = get_post( $post_id );
|
$post = get_post( $post_id );
|
||||||
|
|
||||||
if ( ! empty( $post_id ) && $post && ! $this->check_read_post_permission( $post ) ) {
|
if ( ! empty( $post_id ) && $post && ! $this->check_read_post_permission( $post ) ) {
|
||||||
return new WP_Error( 'rest_cannot_read_post', __( 'Sorry, you cannot read the post for this comment.' ), array( 'status' => rest_authorization_required_code() ) );
|
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() ) );
|
||||||
} elseif ( 0 === $post_id && ! current_user_can( 'moderate_comments' ) ) {
|
} elseif ( 0 === $post_id && ! current_user_can( 'moderate_comments' ) ) {
|
||||||
return new WP_Error( 'rest_cannot_read', __( 'Sorry, you are not allowed to read comments without a post.' ), array( 'status' => rest_authorization_required_code() ) );
|
return new WP_Error( 'rest_cannot_read', __( 'Sorry, you are not allowed to read comments without a post.' ), array( 'status' => rest_authorization_required_code() ) );
|
||||||
}
|
}
|
||||||
@ -399,7 +399,7 @@ class WP_REST_Comments_Controller extends WP_REST_Controller {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if ( ! $this->check_read_post_permission( $post ) ) {
|
if ( ! $this->check_read_post_permission( $post ) ) {
|
||||||
return new WP_Error( 'rest_cannot_read_post', __( 'Sorry, you cannot read the post for this comment.' ), array( 'status' => rest_authorization_required_code() ) );
|
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() ) );
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( ! comments_open( $post->ID ) ) {
|
if ( ! comments_open( $post->ID ) ) {
|
||||||
@ -615,7 +615,7 @@ class WP_REST_Comments_Controller extends WP_REST_Controller {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if ( isset( $request['type'] ) && get_comment_type( $id ) !== $request['type'] ) {
|
if ( isset( $request['type'] ) && get_comment_type( $id ) !== $request['type'] ) {
|
||||||
return new WP_Error( 'rest_comment_invalid_type', __( 'Sorry, you cannot change the comment type.' ), array( 'status' => 404 ) );
|
return new WP_Error( 'rest_comment_invalid_type', __( 'Sorry, you are not allowed to change the comment type.' ), array( 'status' => 404 ) );
|
||||||
}
|
}
|
||||||
|
|
||||||
$prepared_args = $this->prepare_item_for_database( $request );
|
$prepared_args = $this->prepare_item_for_database( $request );
|
||||||
|
@ -4,7 +4,7 @@
|
|||||||
*
|
*
|
||||||
* @global string $wp_version
|
* @global string $wp_version
|
||||||
*/
|
*/
|
||||||
$wp_version = '4.7-beta3-39258';
|
$wp_version = '4.7-beta3-39259';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.
|
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.
|
||||||
|
Loading…
x
Reference in New Issue
Block a user