Ticket #19425: 19425.5.diff
File 19425.5.diff, 5.7 KB (added by , 13 years ago) |
---|
-
wp-includes/admin-bar.php
125 125 } 126 126 127 127 /** 128 * Add the "My Account" menu and all submenus.128 * Add the "My Account" item. 129 129 * 130 * @since 3.3.0 131 */ 132 function wp_admin_bar_my_account_item( $wp_admin_bar ) { 133 $user_id = get_current_user_id(); 134 $current_user = wp_get_current_user(); 135 $profile_url = get_edit_profile_url( $user_id ); 136 137 if ( ! $user_id ) 138 return; 139 140 $avatar = get_avatar( $user_id, 16 ); 141 $howdy = sprintf( __('Howdy, %1$s'), $current_user->display_name ); 142 $class = empty( $avatar ) ? '' : 'with-avatar'; 143 144 $wp_admin_bar->add_menu( array( 145 'id' => 'my-account', 146 'parent' => 'top-secondary', 147 'title' => $howdy . $avatar, 148 'href' => $profile_url, 149 'meta' => array( 150 'class' => $class, 151 'title' => __('My Account'), 152 ), 153 ) ); 154 } 155 156 /** 157 * Add the "My Account" submenu items. 158 * 130 159 * @since 3.1.0 131 160 */ 132 161 function wp_admin_bar_my_account_menu( $wp_admin_bar ) { … … 134 163 $current_user = wp_get_current_user(); 135 164 $profile_url = get_edit_profile_url( $user_id ); 136 165 137 if ( 0 != $user_id ) { 138 /* Add the "My Account" menu */ 139 $avatar = get_avatar( $user_id, 16 ); 140 $howdy = sprintf( __('Howdy, %1$s'), $current_user->display_name ); 141 $class = empty( $avatar ) ? '' : 'with-avatar'; 166 if ( ! $user_id ) 167 return; 142 168 143 $wp_admin_bar->add_menu( array( 144 'id' => 'my-account', 145 'parent' => 'top-secondary', 146 'title' => $howdy . $avatar, 147 'href' => $profile_url, 148 'meta' => array( 149 'class' => $class, 150 'title' => __('My Account'), 151 ), 152 ) ); 169 $wp_admin_bar->add_group( array( 170 'parent' => 'my-account', 171 'id' => 'user-actions', 172 ) ); 153 173 154 /* Add the "My Account" sub menus */ 174 $user_info = get_avatar( $user_id, 64 ); 175 $user_info .= "<span class='display-name'>{$current_user->display_name}</span>"; 155 176 156 $user_info = get_avatar( $user_id, 64 );157 $user_info .= "<span class=' display-name'>{$current_user->display_name}</span>";177 if ( $current_user->display_name !== $current_user->user_nicename ) 178 $user_info .= "<span class='username'>{$current_user->user_nicename}</span>"; 158 179 159 if ( $current_user->display_name !== $current_user->user_nicename ) 160 $user_info .= "<span class='username'>{$current_user->user_nicename}</span>"; 161 162 $wp_admin_bar->add_menu( array( 163 'parent' => 'my-account', 164 'id' => 'user-info', 165 'title' => $user_info, 166 'href' => $profile_url, 167 'meta' => array( 168 'tabindex' => -1 169 ), 170 ) ); 171 $wp_admin_bar->add_menu( array( 172 'parent' => 'my-account', 173 'id' => 'edit-profile', 174 'title' => __( 'Edit My Profile' ), 175 'href' => $profile_url, 176 ) ); 177 $wp_admin_bar->add_menu( array( 178 'parent' => 'my-account', 179 'id' => 'logout', 180 'title' => __( 'Log Out' ), 181 'href' => wp_logout_url(), 182 ) ); 183 } 180 $wp_admin_bar->add_menu( array( 181 'parent' => 'user-actions', 182 'id' => 'user-info', 183 'title' => $user_info, 184 'href' => $profile_url, 185 'meta' => array( 186 'tabindex' => -1, 187 ), 188 ) ); 189 $wp_admin_bar->add_menu( array( 190 'parent' => 'user-actions', 191 'id' => 'edit-profile', 192 'title' => __( 'Edit My Profile' ), 193 'href' => $profile_url, 194 ) ); 195 $wp_admin_bar->add_menu( array( 196 'parent' => 'user-actions', 197 'id' => 'logout', 198 'title' => __( 'Log Out' ), 199 'href' => wp_logout_url(), 200 ) ); 184 201 } 185 202 186 203 /** -
wp-includes/css/admin-bar-rtl.dev.css
107 107 /** 108 108 * My Account 109 109 */ 110 #wpadminbar #wp-admin-bar-my-account.with-avatar #wp-admin-bar- my-account-default> li {110 #wpadminbar #wp-admin-bar-my-account.with-avatar #wp-admin-bar-user-actions > li { 111 111 margin-right: 88px; 112 112 margin-left: 16px; 113 113 } 114 114 115 #wp-admin-bar- my-account-default> li > .ab-item {115 #wp-admin-bar-user-actions > li > .ab-item { 116 116 padding-left: 0; 117 117 padding-right: 8px; 118 118 } -
wp-includes/css/admin-bar.dev.css
323 323 min-width: 270px; 324 324 } 325 325 326 #wpadminbar #wp-admin-bar- my-account-default> li {326 #wpadminbar #wp-admin-bar-user-actions > li { 327 327 margin-left: 16px; 328 328 margin-right: 16px; 329 329 } 330 330 331 #wpadminbar #wp-admin-bar-my-account.with-avatar #wp-admin-bar- my-account-default> li {331 #wpadminbar #wp-admin-bar-my-account.with-avatar #wp-admin-bar-user-actions > li { 332 332 margin-left: 88px; 333 333 } 334 334 335 #wp-admin-bar- my-account-default> li > .ab-item {335 #wp-admin-bar-user-actions > li > .ab-item { 336 336 padding-left: 8px; 337 337 } 338 338 … … 489 489 } 490 490 491 491 /** 492 * Site Menu 493 */ 494 #wpadminbar #wp-admin-bar-appearance { 495 border-top: none; 496 margin-top: -12px; 497 } 498 499 /** 492 500 * ICONS 493 501 */ 494 502 #wpadminbar .ab-icon { -
wp-includes/class-wp-admin-bar.php
363 363 364 364 public function add_menus() { 365 365 // User related, aligned right. 366 add_action( 'admin_bar_menu', 'wp_admin_bar_search_menu', 10 ); 367 add_action( 'admin_bar_menu', 'wp_admin_bar_my_account_menu', 20 ); 366 add_action( 'admin_bar_menu', 'wp_admin_bar_my_account_menu', 0 ); 367 add_action( 'admin_bar_menu', 'wp_admin_bar_search_menu', 4 ); 368 add_action( 'admin_bar_menu', 'wp_admin_bar_my_account_item', 7 ); 368 369 369 370 // Site related. 370 371 add_action( 'admin_bar_menu', 'wp_admin_bar_wp_menu', 10 );