WordPress.org

Make WordPress Core

Changeset 16291


Ignore:
Timestamp:
11/11/2010 11:49:37 AM (11 years ago)
Author:
westi
Message:

Don't show duff links if someone decides that they want the admin bar for all users - even those who are logged out.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/wp-includes/admin-bar.php

    r16287 r16291  
    7272function wp_admin_bar_me_separator() {
    7373    global $wp_admin_bar;
    74     $wp_admin_bar->add_menu( array( 'id' => 'me', 'title' => get_avatar( get_current_user_id(), 16 ), 'href' => get_edit_profile_url( get_current_user_id() ), ) );
     74    $user_id = get_current_user_id();
     75    if ( 0 != $user_id )
     76        $wp_admin_bar->add_menu( array( 'id' => 'me', 'title' => get_avatar( get_current_user_id(), 16 ), 'href' => get_edit_profile_url( $user_id ), ) );
    7577}
    7678
     
    8486
    8587    $user_id = get_current_user_id();
    86 
    87     /* Add the 'My Account' menu */
    88     $wp_admin_bar->add_menu( array( 'id' => 'my-account', 'title' => $user_identity,  'href' => get_edit_profile_url( $user_id ) ) );
    89 
    90     /* Add the "My Account" sub menus */
    91     $wp_admin_bar->add_menu( array( 'parent' => 'my-account', 'title' => __( 'Edit My Profile' ), 'href' => get_edit_profile_url( $user_id ) ) );
    92     if ( is_multisite() )
    93         $wp_admin_bar->add_menu( array( 'parent' => 'my-account', 'title' => __( 'Dashboard' ), 'href' => get_dashboard_url( $user_id ), ) );
    94     else
    95         $wp_admin_bar->add_menu( array( 'parent' => 'my-account', 'title' => __( 'Dashboard' ), 'href' => admin_url(), ) );
    96     $wp_admin_bar->add_menu( array( 'parent' => 'my-account', 'title' => __( 'Log Out' ), 'href' => wp_logout_url(), ) );
     88   
     89    if ( 0 != $user_id ) {
     90        /* Add the 'My Account' menu */
     91        $wp_admin_bar->add_menu( array( 'id' => 'my-account', 'title' => $user_identity,  'href' => get_edit_profile_url( $user_id ) ) );
     92   
     93        /* Add the "My Account" sub menus */
     94        $wp_admin_bar->add_menu( array( 'parent' => 'my-account', 'title' => __( 'Edit My Profile' ), 'href' => get_edit_profile_url( $user_id ) ) );
     95        if ( is_multisite() )
     96            $wp_admin_bar->add_menu( array( 'parent' => 'my-account', 'title' => __( 'Dashboard' ), 'href' => get_dashboard_url( $user_id ), ) );
     97        else
     98            $wp_admin_bar->add_menu( array( 'parent' => 'my-account', 'title' => __( 'Dashboard' ), 'href' => admin_url(), ) );
     99        $wp_admin_bar->add_menu( array( 'parent' => 'my-account', 'title' => __( 'Log Out' ), 'href' => wp_logout_url(), ) );
     100    }
    97101}
    98102
Note: See TracChangeset for help on using the changeset viewer.