Skip to content

Commit

Permalink
Stats: Avoid showing the admin bar widget to logged out visitors (#39402
Browse files Browse the repository at this point in the history
)

* Avoid showing the stats admin bar to non logged in visitors

* changelog
  • Loading branch information
oskosk authored Sep 15, 2024
1 parent 88ae783 commit 1b5ba62
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
Significance: patch
Type: enhancement

Do not check for capabilities if the user is not signed in when deciding whether to show the admin bar widget
5 changes: 5 additions & 0 deletions projects/plugins/jetpack/modules/stats.php
Original file line number Diff line number Diff line change
Expand Up @@ -1032,6 +1032,11 @@ function stats_hide_smile_css() {
* @return void
*/
function stats_admin_bar_head() {
// Let's not show the stats admin bar to users who are not logged in.
if ( ! is_user_logged_in() ) {
return;
}

if ( ! Stats_Options::get_option( 'admin_bar' ) ) {
return;
}
Expand Down

0 comments on commit 1b5ba62

Please sign in to comment.