Ticket #25162: 25162.2.diff
File 25162.2.diff, 2.4 KB (added by , 9 years ago) |
---|
-
src/wp-includes/admin-bar.php
179 179 function wp_admin_bar_my_account_item( $wp_admin_bar ) { 180 180 $user_id = get_current_user_id(); 181 181 $current_user = wp_get_current_user(); 182 $profile_url = get_edit_profile_url( $user_id );183 182 184 183 if ( ! $user_id ) 185 184 return; 186 185 186 if ( current_user_can( 'read' ) ) { 187 $profile_url = get_edit_profile_url( $user_id ); 188 } elseif ( is_multisite() ) { 189 $profile_url = get_dashboard_url( $user_id, 'profile.php' ); 190 } else { 191 $profile_url = '#'; 192 } 193 187 194 $avatar = get_avatar( $user_id, 26 ); 188 195 $howdy = sprintf( __('Howdy, %1$s'), $current_user->display_name ); 189 196 $class = empty( $avatar ) ? '' : 'with-avatar'; … … 209 216 function wp_admin_bar_my_account_menu( $wp_admin_bar ) { 210 217 $user_id = get_current_user_id(); 211 218 $current_user = wp_get_current_user(); 212 $profile_url = get_edit_profile_url( $user_id );213 219 214 220 if ( ! $user_id ) 215 221 return; 216 222 223 if ( current_user_can( 'read' ) ) { 224 $profile_url = get_edit_profile_url( $user_id ); 225 } elseif ( is_multisite() ) { 226 $profile_url = get_dashboard_url( $user_id, 'profile.php' ); 227 } else { 228 $profile_url = '#'; 229 } 230 217 231 $wp_admin_bar->add_group( array( 218 232 'parent' => 'my-account', 219 233 'id' => 'user-actions', … … 234 248 'tabindex' => -1, 235 249 ), 236 250 ) ); 237 $wp_admin_bar->add_menu( array( 238 'parent' => 'user-actions', 239 'id' => 'edit-profile', 240 'title' => __( 'Edit My Profile' ), 241 'href' => $profile_url, 242 ) ); 251 252 if ( '#' !== $profile_url ) { 253 $wp_admin_bar->add_menu( array( 254 'parent' => 'user-actions', 255 'id' => 'edit-profile', 256 'title' => __( 'Edit My Profile' ), 257 'href' => $profile_url, 258 ) ); 259 } 260 243 261 $wp_admin_bar->add_menu( array( 244 262 'parent' => 'user-actions', 245 263 'id' => 'logout', … … 281 299 $wp_admin_bar->add_menu( array( 282 300 'id' => 'site-name', 283 301 'title' => $title, 284 'href' => is_admin() ? home_url( '/' ) : admin_url(),302 'href' => ( is_admin() || ! current_user_can( 'read' ) ) ? home_url( '/' ) : admin_url(), 285 303 ) ); 286 304 287 305 // Create submenu items. … … 304 322 ) ); 305 323 } 306 324 307 } else {325 } else if ( current_user_can( 'read' ) ) { 308 326 // We're on the front end, link to the Dashboard. 309 327 $wp_admin_bar->add_menu( array( 310 328 'parent' => 'site-name',