From 93118d34cfee28a84476bee41d9054f1c6ac8499 Mon Sep 17 00:00:00 2001 From: westi Date: Thu, 9 Jun 2011 11:16:07 +0000 Subject: [PATCH] Only show the Dashboard link if you are logged in. See #17705. git-svn-id: http://svn.automattic.com/wordpress/trunk@18213 1a063a9b-81f0-0310-95a4-ce76da25c4cd --- wp-includes/admin-bar.php | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/wp-includes/admin-bar.php b/wp-includes/admin-bar.php index 1375d2419a..cea2a2c803 100644 --- a/wp-includes/admin-bar.php +++ b/wp-includes/admin-bar.php @@ -99,12 +99,16 @@ function wp_admin_bar_my_account_menu( $wp_admin_bar ) { * @since 3.2.0 */ function wp_admin_bar_dashboard_view_site_menu( $wp_admin_bar ) { - if ( is_admin() ) - $wp_admin_bar->add_menu( array( 'title' => __( 'Visit Site' ), 'href' => home_url() ) ); - elseif ( is_multisite() ) - $wp_admin_bar->add_menu( array( 'title' => __( 'Dashboard' ), 'href' => get_dashboard_url( get_current_user_id() ) ) ); - else - $wp_admin_bar->add_menu( array( 'title' => __( 'Dashboard' ), 'href' => admin_url() ) ); + $user_id = get_current_user_id(); + + if ( 0 != $user_id ) { + if ( is_admin() ) + $wp_admin_bar->add_menu( array( 'title' => __( 'Visit Site' ), 'href' => home_url() ) ); + elseif ( is_multisite() ) + $wp_admin_bar->add_menu( array( 'title' => __( 'Dashboard' ), 'href' => get_dashboard_url( $user_id ) ) ); + else + $wp_admin_bar->add_menu( array( 'title' => __( 'Dashboard' ), 'href' => admin_url() ) ); + } } /**