← All changes
|
json-endpoints/class.wpcom-json-api-get-comment-counts-endpoint.php
+7
-1
13.5.2
→
16.3-a.1
View file →
| @@ -2,8 +2,12 @@ | ||
| 2 | 2 | /** |
| 3 | 3 | * Endpoint: /sites/%s/comment-counts |
| 4 | 4 | */ |
| 5 | 5 | |
| 6 | +if ( ! defined( 'ABSPATH' ) ) { | |
| 7 | + exit( 0 ); | |
| 8 | +} | |
| 9 | + | |
| 6 | 10 | new WPCOM_JSON_API_GET_Comment_Counts_Endpoint( |
| 7 | 11 | array( |
| 8 | 12 | 'description' => 'Get comment counts for each available status', |
| 9 | 13 | 'group' => 'comments', |
| @@ -33,8 +37,10 @@ | ||
| 33 | 37 | ); |
| 34 | 38 | |
| 35 | 39 | /** |
| 36 | 40 | * GET Comment Counts endpoint class. |
| 41 | + * | |
| 42 | + * @phan-constructor-used-for-side-effects | |
| 37 | 43 | */ |
| 38 | 44 | class WPCOM_JSON_API_GET_Comment_Counts_Endpoint extends WPCOM_JSON_API_Endpoint { |
| 39 | 45 | /** |
| 40 | 46 | * |
| @@ -53,9 +59,9 @@ | ||
| 53 | 59 | if ( ! get_current_user_id() ) { |
| 54 | 60 | return new WP_Error( 'authorization_required', 'An active access token must be used to retrieve comment counts.', 403 ); |
| 55 | 61 | } |
| 56 | 62 | |
| 57 | - if ( ! current_user_can_for_blog( $blog_id, 'edit_posts' ) ) { | |
| 63 | + if ( ! current_user_can_for_site( $blog_id, 'edit_posts' ) ) { | |
| 58 | 64 | return new WP_Error( 'authorization_required', 'You are not authorized to view comment counts for this blog.', 403 ); |
| 59 | 65 | } |
| 60 | 66 | |
| 61 | 67 | $args = $this->query_args(); |