PluginProbe
Jetpack – WP Security, Backup, Speed, & Growth / 16.3-a.1
Jetpack – WP Security, Backup, Speed, & Growth v16.3-a.1
16.3-a.3 16.3-a.1 16.2 16.2-beta 12.0.3 12.1.3 12.2.3 12.3.2 12.4.2 12.5.2 12.6.4 12.7.3 12.8.3 12.9.5 13.0.2 13.1.5 13.2.4 13.3.3 13.4.5 13.5.2 13.6.2 13.7.2 13.8.3 13.9.2 14.0.1 All 504 releases
← All changes | _inc/lib/core-api/wpcom-endpoints/subscribers.php +7 -2 13.5.216.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' );