Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Only show the dashboard widgets if the user has enough permissions #368

Merged
merged 1 commit into from
Oct 15, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions includes/class-admin.php
Original file line number Diff line number Diff line change
Expand Up @@ -2827,6 +2827,10 @@ public function admin_bar_friends_menu( \WP_Admin_Bar $wp_menu ) {
$on_my_own_site = true;
}

if ( ! $my_url ) {
return;
}

if ( ! $on_my_own_site && $my_own_site ) {
switch_to_blog( $my_own_site->blog_id );
}
Expand Down Expand Up @@ -3126,6 +3130,9 @@ public function dashboard_glance_items( $items ) {
}

public function add_dashboard_widgets() {
if ( ! Friends::has_required_privileges() ) {
return;
}
$user_id = get_current_user_id();
$widgets = get_user_option( 'friends_dashboard_widgets', $user_id );
if ( ! $widgets ) {
Expand Down
Loading