← All changes
|
_inc/lib/core-api/wpcom-endpoints/subscribers.php
+7
-2
13.6.2
→
16.3-a.1
View file →
| @@ -5,8 +5,12 @@ | ||
| 5 | 5 | * @package automattic/jetpack |
| 6 | 6 | */ |
| 7 | 7 | use Automattic\Jetpack\Constants; |
| 8 | 8 | |
| 9 | +if ( ! defined( 'ABSPATH' ) ) { | |
| 10 | + exit( 0 ); | |
| 11 | +} | |
| 12 | + | |
| 9 | 13 | /** |
| 10 | 14 | * Subscribers: Get subscriber count |
| 11 | 15 | * |
| 12 | 16 | * @since 6.9 |
| @@ -56,9 +60,10 @@ | ||
| 56 | 60 | /** |
| 57 | 61 | * Permission check. Only authors can access this endpoint. |
| 58 | 62 | */ |
| 59 | 63 | public function readable_permission_check() { |
| 60 | - if ( ! current_user_can_for_blog( get_current_blog_id(), 'edit_posts' ) ) { | |
| 64 | + | |
| 65 | + if ( ! current_user_can_for_site( get_current_blog_id(), 'edit_posts' ) ) { | |
| 61 | 66 | return new WP_Error( 'authorization_required', 'Only users with the permission to edit posts can see the subscriber count.', array( 'status' => 401 ) ); |
| 62 | 67 | } |
| 63 | 68 | |
| 64 | 69 | return true; |
| @@ -85,9 +90,9 @@ | ||
| 85 | 90 | |
| 86 | 91 | /** |
| 87 | 92 | * Retrieves splitted subscriber counts |
| 88 | 93 | * |
| 89 | - * @return array data object containing subscriber counts ['email_subscribers' => 0, 'social_followers' => 0] | |
| 94 | + * @return array data object containing subscriber counts. | |
| 90 | 95 | */ |
| 91 | 96 | public function get_subscriber_counts() { |
| 92 | 97 | if ( ! Constants::is_defined( 'TESTING_IN_JETPACK' ) ) { |
| 93 | 98 | delete_transient( 'wpcom_subscribers_totals' ); |