From 3c5fc7d7d24f7a07712a04719aed1b8af1d77db1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Frank=20B=C3=BCltge?= Date: Mon, 25 Feb 2019 09:08:38 +0100 Subject: [PATCH] Fix php notices. --- inc/autoload/class-admin-bar-tweaks.php | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/inc/autoload/class-admin-bar-tweaks.php b/inc/autoload/class-admin-bar-tweaks.php index 6ef79c5..ab92e57 100755 --- a/inc/autoload/class-admin-bar-tweaks.php +++ b/inc/autoload/class-admin-bar-tweaks.php @@ -46,7 +46,7 @@ public function enhance_network_admin_bar() { global $wp_admin_bar; // Show only when the user has at least one site, or they're a super admin. - if ( count( $wp_admin_bar->user->blogs ) < 1 ) { + if ( ! isset( $wp_admin_bar->user->blogs ) || count( $wp_admin_bar->user->blogs ) < 1 ) { return; } @@ -90,6 +90,10 @@ public function enhance_network_blog_admin_bar() { */ global $wp_admin_bar; + if ( ! isset( $wp_admin_bar->user->blogs ) ) { + return; + } + foreach ( (array) $wp_admin_bar->user->blogs as $blog ) { switch_to_blog( $blog->userblog_id );