Skip to content

Commit

Permalink
Stats: Show stats widget to admins on Simple sites (#41549)
Browse files Browse the repository at this point in the history
* Temporarily show the widget to administrators for Simple sites

* changelog

* Restore apply_filters for the user capability
  • Loading branch information
dognose24 authored Feb 5, 2025
1 parent 0c2bb97 commit 4967a2f
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 1 deletion.
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
Significance: patch
Type: bugfix

Temporarily show the widget to administrators for Simple sites
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,10 @@ public static function wp_dashboard_setup() {
*
* @param bool Whether to show the widget to the current user.
*/
if ( ! apply_filters( 'jetpack_stats_dashboard_widget_show_to_user', current_user_can( 'view_stats' ) ) ) {
// Temporarily show the widget to administrators for Simple sites as the view_stats capability is not available.
// TODO: Grant the view_stats capability to corresponding users for Simple sites.
$can_user_view_stats = current_user_can( 'manage_options' ) || current_user_can( 'view_stats' );
if ( ! apply_filters( 'jetpack_stats_dashboard_widget_show_to_user', $can_user_view_stats ) ) {
return;
}

Expand Down

0 comments on commit 4967a2f

Please sign in to comment.