diff options
Diffstat (limited to 'plugins/jetpack/json-endpoints/class.wpcom-json-api-update-comment-endpoint.php')
-rw-r--r-- | plugins/jetpack/json-endpoints/class.wpcom-json-api-update-comment-endpoint.php | 18 |
1 files changed, 17 insertions, 1 deletions
diff --git a/plugins/jetpack/json-endpoints/class.wpcom-json-api-update-comment-endpoint.php b/plugins/jetpack/json-endpoints/class.wpcom-json-api-update-comment-endpoint.php index 9c96d422..517e6710 100644 --- a/plugins/jetpack/json-endpoints/class.wpcom-json-api-update-comment-endpoint.php +++ b/plugins/jetpack/json-endpoints/class.wpcom-json-api-update-comment-endpoint.php @@ -50,7 +50,20 @@ class WPCOM_JSON_API_Update_Comment_Endpoint extends WPCOM_JSON_API_Comment_Endp return new WP_Error( 'unknown_post', 'Unknown post', 404 ); } - if ( -1 == get_option( 'blog_public' ) && ! apply_filters( 'wpcom_json_api_user_is_member_of_blog', is_user_member_of_blog() ) && ! is_super_admin() ) { + if ( + -1 == get_option( 'blog_public' ) && + /** + * Filter allowing non-registered users on the site to comment. + * + * @module json-api + * + * @since 3.4.0 + * + * @param bool is_user_member_of_blog() Is the user member of the site. + */ + ! apply_filters( 'wpcom_json_api_user_is_member_of_blog', is_user_member_of_blog() ) && + ! is_super_admin() + ) { return new WP_Error( 'unauthorized', 'User cannot create comments', 403 ); } @@ -127,6 +140,7 @@ class WPCOM_JSON_API_Update_Comment_Endpoint extends WPCOM_JSON_API_Comment_Endp return $return; } + /** This action is documented in json-endpoints/class.wpcom-json-api-site-settings-endpoint.php */ do_action( 'wpcom_json_api_objects', 'comments' ); return $return; } @@ -215,6 +229,7 @@ class WPCOM_JSON_API_Update_Comment_Endpoint extends WPCOM_JSON_API_Comment_Endp return $return; } + /** This action is documented in json-endpoints/class.wpcom-json-api-site-settings-endpoint.php */ do_action( 'wpcom_json_api_objects', 'comments' ); return $return; } @@ -236,6 +251,7 @@ class WPCOM_JSON_API_Update_Comment_Endpoint extends WPCOM_JSON_API_Comment_Endp return $return; } + /** This action is documented in json-endpoints/class.wpcom-json-api-site-settings-endpoint.php */ do_action( 'wpcom_json_api_objects', 'comments' ); wp_delete_comment( $comment->comment_ID ); |