From 96b942e891037574e63fe99f7416ea1d96e0e5e8 Mon Sep 17 00:00:00 2001 From: westi Date: Fri, 16 Sep 2011 10:56:06 +0000 Subject: [PATCH] We don't need to do this if the user isn't logged in. git-svn-id: http://svn.automattic.com/wordpress/trunk@18688 1a063a9b-81f0-0310-95a4-ce76da25c4cd --- wp-includes/class-wp-admin-bar.php | 24 +++++++++++++----------- 1 file changed, 13 insertions(+), 11 deletions(-) diff --git a/wp-includes/class-wp-admin-bar.php b/wp-includes/class-wp-admin-bar.php index d365e1123d..7ddac71c9c 100644 --- a/wp-includes/class-wp-admin-bar.php +++ b/wp-includes/class-wp-admin-bar.php @@ -14,18 +14,20 @@ class WP_Admin_Bar { $this->user = new stdClass; $this->menu = new stdClass; - /* Populate settings we need for the menu based on the current user. */ - $this->user->blogs = get_blogs_of_user( get_current_user_id() ); - if ( is_multisite() ) { - $this->user->active_blog = get_active_blog_for_user( get_current_user_id() ); - $this->user->domain = empty( $this->user->active_blog ) ? user_admin_url() : trailingslashit( get_home_url( $this->user->active_blog->blog_id ) ); - $this->user->account_domain = $this->user->domain; - } else { - $this->user->active_blog = $this->user->blogs[get_current_blog_id()]; - $this->user->domain = trailingslashit( home_url() ); - $this->user->account_domain = $this->user->domain; + if ( is_user_logged_in() ) { + /* Populate settings we need for the menu based on the current user. */ + $this->user->blogs = get_blogs_of_user( get_current_user_id() ); + if ( is_multisite() ) { + $this->user->active_blog = get_active_blog_for_user( get_current_user_id() ); + $this->user->domain = empty( $this->user->active_blog ) ? user_admin_url() : trailingslashit( get_home_url( $this->user->active_blog->blog_id ) ); + $this->user->account_domain = $this->user->domain; + } else { + $this->user->active_blog = $this->user->blogs[get_current_blog_id()]; + $this->user->domain = trailingslashit( home_url() ); + $this->user->account_domain = $this->user->domain; + } + $this->user->locale = get_locale(); } - $this->user->locale = get_locale(); add_action( 'wp_head', 'wp_admin_bar_header' );