PluginProbe
Jetpack – WP Security, Backup, Speed, & Growth / 16.3-a.7
Jetpack – WP Security, Backup, Speed, & Growth v16.3-a.7
16.3-a.5 16.3-a.7 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 All 506 releases
← All changes | class-jetpack-stats-dashboard-widget.php +10 -11 16.2 → 16.3-a.7 View file →
@@ -40,19 +40,18 @@
40 40 /**
41 41 * Sets up the Jetpack Stats widget in the WordPress admin dashboard.
42 42 */
43 43 public static function wp_dashboard_setup() {
44 - /**
45 - * Filter whether the Jetpack Stats dashboard widget should be shown to the current user.
46 - * By default, the dashboard widget is shown to users who can view_stats.
47 - *
48 - * @module stats
49 - * @since 11.9
50 - *
51 - * @param bool Whether to show the widget to the current user.
52 - */
53 - // Temporarily show the widget to administrators for Simple sites as the view_stats capability is not available.
54 - // TODO: Grant the view_stats capability to corresponding users for Simple sites.
44 + // WordPress.com Simple sites load this class next to the stats-admin copy in jetpack-mu-wpcom, which can predate register_widget().
45 + if ( method_exists( Dashboard_Stats_Widget::class, 'register_widget' ) ) {
46 + // Atomic filters readiness to require a connected owner, which the package's own connection check does not see.
47 + if ( Jetpack::is_connection_ready() && Dashboard_Stats_Widget::register_widget() ) {
48 + add_action( 'admin_head', array( static::class, 'admin_head' ) );
49 + }
50 + return;
51 + }
52 +
53 + /** This filter is documented in projects/packages/stats-admin/src/class-wp-dashboard-odyssey-widget.php */
55 54 $can_user_view_stats = current_user_can( 'manage_options' ) || current_user_can( 'view_stats' );
56 55 if ( ! apply_filters( 'jetpack_stats_dashboard_widget_show_to_user', $can_user_view_stats ) ) {
57 56 return;
58 57 }