From 91b5d4baa540bcb8f3a648439e6b82885f33ee3e Mon Sep 17 00:00:00 2001 From: Andrew Nacin Date: Mon, 7 Nov 2011 17:27:24 +0000 Subject: [PATCH] Clean up wp_admin_bar_my_account_menu() a bit. see #19193. git-svn-id: https://develop.svn.wordpress.org/trunk@19201 602fd350-edb4-49c9-b593-d223f7449a82 --- wp-includes/admin-bar.php | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) diff --git a/wp-includes/admin-bar.php b/wp-includes/admin-bar.php index bb14d003c0..15ebb67b66 100644 --- a/wp-includes/admin-bar.php +++ b/wp-includes/admin-bar.php @@ -144,10 +144,11 @@ function wp_admin_bar_my_account_menu( $wp_admin_bar ) { $user_id = get_current_user_id(); $current_user = wp_get_current_user(); + $profile_url = get_edit_profile_url( $user_id ); if ( 0 != $user_id ) { /* Add the 'My Account' menu */ - $avatar = get_avatar( get_current_user_id(), 28 ); + $avatar = get_avatar( $user_id, 28 ); $howdy = sprintf( __('Howdy, %1$s'), $user_identity ); $class = 'opposite'; @@ -157,7 +158,7 @@ function wp_admin_bar_my_account_menu( $wp_admin_bar ) { $wp_admin_bar->add_menu( array( 'id' => 'my-account', 'title' => $howdy . $avatar, - 'href' => get_edit_profile_url( $user_id ), + 'href' => $profile_url, 'meta' => array( 'class' => $class, ), @@ -165,9 +166,7 @@ function wp_admin_bar_my_account_menu( $wp_admin_bar ) { /* Add the "My Account" sub menus */ - - - $user_info = get_avatar( get_current_user_id(), 64 ); + $user_info = get_avatar( $user_id, 64 ); $user_info .= "{$current_user->display_name}"; if ( $current_user->display_name !== $current_user->user_nicename ) @@ -177,16 +176,16 @@ function wp_admin_bar_my_account_menu( $wp_admin_bar ) { 'parent' => 'my-account', 'id' => 'user-info', 'title' => $user_info, - 'href' => get_edit_profile_url( $user_id ), + 'href' => $profile_url, 'meta' => array( - 'class' => 'user-info user-info-item' + 'class' => 'user-info user-info-item', ), ) ); $wp_admin_bar->add_menu( array( 'parent' => 'my-account', 'id' => 'edit-profile', 'title' => __( 'Edit My Profile' ), - 'href' => get_edit_profile_url( $user_id ), + 'href' => $profile_url, 'meta' => array( 'class' => 'user-info-item', ),