Skip to:
Content

BuddyPress.org

Changeset 4151


Ignore:
Timestamp:
03/24/2011 05:26:18 AM (13 years ago)
Author:
johnjamesjacoby
Message:

This first pass at WP Admin Bar integration unhooks all WP core menus and replaces them with a full set of action based routines to handle the creation of admin bar menus at a BP component class level. This allows future external components to manipulate core menus or add their own with relative ease. Currently works off the BP_USE_WP_ADMIN_BAR constant, and should eventually phase out the BuddyBar in the long-term.

Location:
trunk
Files:
13 edited

Legend:

Unmodified
Added
Removed
  • trunk/bp-activity/bp-activity-loader.php

    r3917 r4151  
    101101
    102102        // Determine user to use
    103         if ( isset( $bp->displayed_user->domain ) ) {
     103        if ( isset( $bp->displayed_user->domain ) )
    104104            $user_domain = $bp->displayed_user->domain;
    105             $user_login  = $bp->displayed_user->userdata->user_login;
    106         } elseif ( isset( $bp->loggedin_user->domain ) ) {
     105        elseif ( isset( $bp->loggedin_user->domain ) )
    107106            $user_domain = $bp->loggedin_user->domain;
    108             $user_login  = $bp->loggedin_user->userdata->user_login;
    109         } else {
     107        else
    110108            return;
    111         }
    112109
    113110        // User link
     
    124121        );
    125122
     123        // @ mentions
     124        $sub_nav[] = array(
     125            'name'            => __( 'Mentions', 'buddypress' ),
     126            'slug'            => 'mentions',
     127            'parent_url'      => $activity_link,
     128            'parent_slug'     => $this->slug,
     129            'screen_function' => 'bp_activity_screen_mentions',
     130            'position'        => 20,
     131            'item_css_id'     => 'activity-mentions'
     132        );
     133
     134        // Favorite activity items
     135        $sub_nav[] = array(
     136            'name'            => __( 'Favorites', 'buddypress' ),
     137            'slug'            => 'favorites',
     138            'parent_url'      => $activity_link,
     139            'parent_slug'     => $this->slug,
     140            'screen_function' => 'bp_activity_screen_favorites',
     141            'position'        => 30,
     142            'item_css_id'     => 'activity-favs'
     143        );
     144
    126145        // Additional menu if friends is active
    127146        if ( bp_is_active( 'friends' ) ) {
     
    132151                'parent_slug'     => $this->slug,
    133152                'screen_function' => 'bp_activity_screen_friends',
    134                 'position'        => 20,
     153                'position'        => 40,
    135154                'item_css_id'     => 'activity-friends'
    136155            ) ;
     
    145164                'parent_slug'     => $this->slug,
    146165                'screen_function' => 'bp_activity_screen_groups',
    147                 'position'        => 30,
     166                'position'        => 50,
    148167                'item_css_id'     => 'activity-groups'
    149168            );
    150169        }
    151170
    152         // Favorite activity items
    153         $sub_nav[] = array(
    154             'name'            => __( 'Favorites', 'buddypress' ),
    155             'slug'            => 'favorites',
    156             'parent_url'      => $activity_link,
    157             'parent_slug'     => $this->slug,
    158             'screen_function' => 'bp_activity_screen_favorites',
    159             'position'        => 40,
    160             'item_css_id'     => 'activity-favs'
    161         );
    162 
    163         // @ mentions
    164         $sub_nav[] = array(
    165             'name'            => sprintf( __( '@%s Mentions', 'buddypress' ), $user_login ),
    166             'slug'            => 'mentions',
    167             'parent_url'      => $activity_link,
    168             'parent_slug'     => $this->slug,
    169             'screen_function' => 'bp_activity_screen_mentions',
    170             'position'        => 50,
    171             'item_css_id'     => 'activity-mentions'
    172         );
    173 
    174171        parent::_setup_nav( $main_nav, $sub_nav );
     172    }
     173
     174    /**
     175     * Set up the admin bar
     176     *
     177     * @global obj $bp
     178     */
     179    function _setup_admin_bar() {
     180        global $bp;
     181
     182        // Menus for logged in user
     183        if ( is_user_logged_in() ) {
     184
     185            // Setup the logged in user variables
     186            $user_domain   = $bp->loggedin_user->domain;
     187            $activity_link = trailingslashit( $user_domain . $this->slug );
     188
     189            // Add the "Activity" sub menu
     190            $wp_admin_nav[] = array(
     191                'parent' => $bp->my_account_menu_id,
     192                'id'     => 'my-account-' . $this->id,
     193                'title'  => __( 'Activity', 'buddypress' ),
     194                'href'   => trailingslashit( $activity_link )
     195            );
     196
     197            // Mentions
     198            $wp_admin_nav[] = array(
     199                'parent' => 'my-account-' . $this->id,
     200                'title'  => __( 'Mentions', 'buddypress' ),
     201                'href'   => trailingslashit( $activity_link . 'mentions' )
     202            );
     203
     204            // Personal
     205            $wp_admin_nav[] = array(
     206                'parent' => 'my-account-' . $this->id,
     207                'title'  => __( 'Personal', 'buddypress' ),
     208                'href'   => trailingslashit( $activity_link )
     209            );
     210
     211            // Favorites
     212            $wp_admin_nav[] = array(
     213                'parent' => 'my-account-' . $this->id,
     214                'title'  => __( 'Favorites', 'buddypress' ),
     215                'href'   => trailingslashit( $activity_link . 'favorites' )
     216            );
     217
     218            // Friends?
     219            if ( bp_is_active( 'friends' ) ) {
     220                $wp_admin_nav[] = array(
     221                    'parent' => 'my-account-' . $this->id,
     222                    'title'  => __( 'Friends', 'buddypress' ),
     223                    'href'   => trailingslashit( $activity_link . bp_get_friends_slug() )
     224                );
     225            }
     226
     227            // Groups?
     228            if ( bp_is_active( 'groups' ) ) {
     229                $wp_admin_nav[] = array(
     230                    'parent' => 'my-account-' . $this->id,
     231                    'title'  => __( 'Groups', 'buddypress' ),
     232                    'href'   => trailingslashit( $activity_link . bp_get_groups_slug() )
     233                );
     234            }
     235        }
     236
     237        parent::_setup_admin_bar( $wp_admin_nav );
    175238    }
    176239
  • trunk/bp-blogs/bp-blogs-loader.php

    r4041 r4151  
    113113        parent::_setup_nav( $main_nav );
    114114    }
    115    
     115
     116    /**
     117     * Set up the admin bar
     118     *
     119     * @global obj $bp
     120     */
     121    function _setup_admin_bar() {
     122        global $bp;
     123
     124        // Menus for logged in user
     125        if ( is_user_logged_in() ) {
     126
     127            $blogs_link = trailingslashit( $bp->loggedin_user->domain . $this->slug );
     128
     129            // Add the "Blogs" sub menu
     130            $wp_admin_nav[] = array(
     131                'parent' => $bp->my_account_menu_id,
     132                'id'     => 'my-account-' . $this->id,
     133                'title'  => __( 'Blogs', 'buddypress' ),
     134                'href'   => trailingslashit( $blogs_link )
     135            );
     136
     137            // My Blogs
     138            $wp_admin_nav[] = array(
     139                'parent' => 'my-account-' . $this->id,
     140                'title'  => __( 'My Blogs', 'buddypress' ),
     141                'href'   => trailingslashit( $blogs_link . 'my-blogs' )
     142            );
     143
     144        }
     145
     146        parent::_setup_admin_bar( $wp_admin_nav );
     147    }
     148
    116149    /**
    117150     * Sets up the title for pages and <title>
  • trunk/bp-core/bp-core-adminbar.php

    r3817 r4151  
    22
    33/**
    4  * Reserved for WordPress admin bar functions
     4 * BuddyPress Core Admin Bar
     5 *
     6 * Handles the core functions related to the WordPress Admin Bar
     7 *
     8 * @package BuddyPress
     9 * @subpackage Core
    510 */
    611
     12/**
     13 * Unhook the WordPress core menus. We will be adding our own to replace these.
     14 *
     15 * @todo Single blog/post/group/user/forum/activity menus
     16 * @todo Admin/moderator menus
     17 *
     18 * @since BuddyPress (r4151)
     19 *
     20 * @uses remove_action
     21 * @uses is_network_admin()
     22 * @uses is_user_admin()
     23 */
     24function bp_admin_bar_remove_wp_menus() {
     25    remove_action( 'admin_bar_menu', 'wp_admin_bar_my_account_menu', 10 );
     26    remove_action( 'admin_bar_menu', 'wp_admin_bar_my_sites_menu',   20 );
     27    remove_action( 'admin_bar_menu', 'wp_admin_bar_edit_menu',       30 );
     28    remove_action( 'admin_bar_menu', 'wp_admin_bar_shortlink_menu',  80 );
     29
     30    if ( !is_network_admin() && !is_user_admin() ) {
     31        remove_action( 'admin_bar_menu', 'wp_admin_bar_new_content_menu', 40 );
     32        remove_action( 'admin_bar_menu', 'wp_admin_bar_comments_menu',    50 );
     33        remove_action( 'admin_bar_menu', 'wp_admin_bar_appearance_menu',  60 );
     34    }
     35
     36    remove_action( 'admin_bar_menu', 'wp_admin_bar_updates_menu',    70 );
     37}
     38if ( defined( 'BP_USE_WP_ADMIN_BAR' ) )
     39    add_action( 'bp_init', 'bp_admin_bar_remove_wp_menus', 2 );
     40
    741?>
  • trunk/bp-core/bp-core-component.php

    r3991 r4151  
    5454
    5555    /**
     56     * @var array WordPress admin bar links
     57     */
     58    var $admin_menu;
     59
     60    /**
    5661     * Component loader
    5762     *
     
    189194
    190195        // Register post types
     196        add_action( 'bp_setup_admin_bar',          array ( $this, '_setup_admin_bar'         ), 10 );
     197
     198        // Register post types
    191199        add_action( 'bp_setup_title',              array ( $this, '_setup_title'             ), 10 );
    192200
     
    214222     */
    215223    function _setup_nav( $main_nav = '', $sub_nav = '' ) {
     224
    216225        // No sub nav items without a main nav item
    217226        if ( !empty( $main_nav ) ) {
     
    231240
    232241    /**
     242     * Setup the admin bar
     243     *
     244     * @global obj $wp_admin_bar
     245     * @param array $wp_admin_menus
     246     */
     247    function _setup_admin_bar( $wp_admin_nav = '' ) {
     248
     249        // Do not proceed if constant is not set
     250        if ( !defined( 'BP_USE_WP_ADMIN_BAR' ) )
     251            return;
     252
     253        // Do we have admin bar menus to add?
     254        if ( !empty( $wp_admin_nav ) ) {
     255
     256            // Set this objects menus
     257            $this->admin_menu = $wp_admin_nav;
     258
     259            // Define the WordPress global
     260            global $wp_admin_bar;
     261
     262            // Add each admin menu
     263            foreach( $this->admin_menu as $admin_menu )
     264                $wp_admin_bar->add_menu( $admin_menu );
     265        }
     266
     267        // Call action
     268        do_action( 'bp_' . $this->id . '_setup_admin_bar' );
     269    }
     270
     271    /**
    233272     * Setup the component title
    234273     *
  • trunk/bp-core/bp-core-hooks.php

    r3980 r4151  
    2323
    2424// Setup the navigation menu
    25 add_action( 'bp_init',    'bp_setup_nav',            8 );
     25add_action( 'bp_init',    'bp_setup_nav',            7 );
     26
     27// Setup the navigation menu
     28add_action( 'bp_init',    'bp_setup_admin_bar',      8 );
    2629
    2730// Setup the title
    28 add_action( 'bp_init',    'bp_setup_title',          8 );
     31add_action( 'bp_init',    'bp_setup_title',          9 );
    2932
    3033// Setup widgets
     
    5558function bp_setup_nav() {
    5659    do_action( 'bp_setup_nav' );
     60}
     61
     62/**
     63 * Set navigation elements
     64 */
     65function bp_setup_admin_bar() {
     66    do_action( 'bp_setup_admin_bar' );
    5767}
    5868
  • trunk/bp-core/bp-core-loader.php

    r4052 r4151  
    116116            $bp->pages = bp_core_get_page_names();
    117117
     118        /** Admin Bar *********************************************************/
     119
     120        // Set the 'My Account' global to prevent debug notices
     121        $bp->my_account_menu_id = false;
     122
    118123        /** Component and Action **********************************************/
    119124
  • trunk/bp-forums/bp-forums-loader.php

    r4012 r4151  
    131131            'screen_function' => 'bp_member_forums_screen_topics',
    132132            'position'        => 20,
    133             'item_css_id'     => 'forums-friends'
     133            'item_css_id'     => 'topics'
    134134        );
    135135
     
    142142            'screen_function' => 'bp_member_forums_screen_replies',
    143143            'position'        => 40,
    144             'item_css_id'     => 'forums-friends'
     144            'item_css_id'     => 'replies'
    145145        );
    146146
     
    153153            'screen_function' => 'bp_member_forums_screen_favorites',
    154154            'position'        => 60,
    155             'item_css_id'     => 'forums-favs'
     155            'item_css_id'     => 'favorites'
    156156        );
    157157
    158158        parent::_setup_nav( $main_nav, $sub_nav );
     159    }
     160
     161    /**
     162     * Set up the admin bar
     163     *
     164     * @global obj $bp
     165     */
     166    function _setup_admin_bar() {
     167        global $bp;
     168
     169        // "My Account" menu
     170        if ( is_user_logged_in() ) {
     171
     172            // Setup the logged in user variables
     173            $user_domain = $bp->loggedin_user->domain;
     174            $user_login  = $bp->loggedin_user->userdata->user_login;
     175            $forums_link = trailingslashit( $user_domain . $this->slug );
     176
     177            // Add the "My Account" sub menus
     178            $wp_admin_nav[] = array(
     179                'parent' => $bp->my_account_menu_id,
     180                'id'     => 'my-account-' . $this->id,
     181                'title'  => __( 'Forums', 'buddypress' ),
     182                'href'   => trailingslashit( $forums_link )
     183            );
     184
     185            // Topics
     186            $wp_admin_nav[] = array(
     187                'parent' => 'my-account-' . $this->id,
     188                'title'  => __( 'My Topics', 'buddypress' ),
     189                'href'   => trailingslashit( $forums_link . 'topics' )
     190            );
     191
     192            // Replies
     193            $wp_admin_nav[] = array(
     194                'parent' => 'my-account-' . $this->id,
     195                'title'  => __( 'My Replies', 'buddypress' ),
     196                'href'   => trailingslashit( $forums_link . 'replies' )
     197            );
     198
     199            // Favorites
     200            $wp_admin_nav[] = array(
     201                'parent' => 'my-account-' . $this->id,
     202                'title'  => __( 'My Favorites', 'buddypress' ),
     203                'href'   => trailingslashit( $forums_link . 'favorites' )
     204            );
     205        }
     206
     207        parent::_setup_admin_bar( $wp_admin_nav );
    159208    }
    160209
  • trunk/bp-friends/bp-friends-loader.php

    r3917 r4151  
    124124
    125125        parent::_setup_nav( $main_nav, $sub_nav );
     126    }
     127
     128    /**
     129     * Set up the admin bar
     130     *
     131     * @global obj $bp
     132     */
     133    function _setup_admin_bar() {
     134        global $bp;
     135
     136        // "My Account" menu
     137        if ( is_user_logged_in() ) {
     138
     139            // Setup the logged in user variables
     140            $user_domain  = $bp->loggedin_user->domain;
     141            $friends_link = trailingslashit( $user_domain . $this->slug );
     142
     143            // Pending friend requests
     144            if ( $count = count( friends_get_friendship_request_user_ids( $bp->loggedin_user->id ) ) ) {
     145                $title   = sprintf( __( 'Friends <strong>(%s)</strong>',          'buddypress' ), $count );
     146                $pending = sprintf( __( 'Pending Requests <strong>(%s)</strong>', 'buddypress' ), $count );
     147            } else {
     148                $title   = __( 'Friends',             'buddypress' );
     149                $pending = __( 'No Pending Requests', 'buddypress' );
     150            }
     151
     152            // Add the "My Account" sub menus
     153            $wp_admin_nav[] = array(
     154                'parent' => $bp->my_account_menu_id,
     155                'id'     => 'my-account-' . $this->id,
     156                'title'  => $title,
     157                'href'   => trailingslashit( $friends_link )
     158            );
     159
     160            // My Groups
     161            $wp_admin_nav[] = array(
     162                'parent' => 'my-account-' . $this->id,
     163                'title'  => __( 'My Friends', 'buddypress' ),
     164                'href'   => trailingslashit( $friends_link )
     165            );
     166
     167            // Requests
     168            $wp_admin_nav[] = array(
     169                'parent' => 'my-account-' . $this->id,
     170                'title'  => $pending,
     171                'href'   => trailingslashit( $friends_link . 'requests' )
     172            );
     173        }
     174
     175        parent::_setup_admin_bar( $wp_admin_nav );
    126176    }
    127177
  • trunk/bp-groups/bp-groups-loader.php

    r4088 r4151  
    338338
    339339    /**
     340     * Set up the admin bar
     341     *
     342     * @global obj $bp
     343     */
     344    function _setup_admin_bar() {
     345        global $bp;
     346
     347        // Menus for logged in user
     348        if ( is_user_logged_in() ) {
     349
     350            // Setup the logged in user variables
     351            $user_domain = $bp->loggedin_user->domain;
     352            $groups_link = trailingslashit( $user_domain . $this->slug );
     353
     354            // Pending group invites
     355            $count = groups_get_invites_for_user( $bp->loggedin_user->id );
     356
     357            if ( !empty( $count->total ) ) {
     358                $title   = sprintf( __( 'Groups <strong>(%s)</strong>',          'buddypress' ), $count->total );
     359                $pending = sprintf( __( 'Pending Invites <strong>(%s)</strong>', 'buddypress' ), $count->total );
     360            } else {
     361                $title   = __( 'Groups',             'buddypress' );
     362                $pending = __( 'No Pending Invites', 'buddypress' );
     363            }
     364
     365            // Add the "My Account" sub menus
     366            $wp_admin_nav[] = array(
     367                'parent' => $bp->my_account_menu_id,
     368                'id'     => 'my-account-' . $this->id,
     369                'title'  => $title,
     370                'href'   => trailingslashit( $groups_link )
     371            );
     372
     373            // My Groups
     374            $wp_admin_nav[] = array(
     375                'parent' => 'my-account-' . $this->id,
     376                'title'  => __( 'My Groups', 'buddypress' ),
     377                'href'   => trailingslashit( $groups_link )
     378            );
     379
     380            // Invitations
     381            $wp_admin_nav[] = array(
     382                'parent' => 'my-account-' . $this->id,
     383                'title'  => $pending,
     384                'href'   => trailingslashit( $groups_link . 'invites' )
     385            );
     386        }
     387
     388        parent::_setup_admin_bar( $wp_admin_nav );
     389    }
     390
     391    /**
    340392     * Sets up the title for pages and <title>
    341393     *
  • trunk/bp-members/bp-members-loader.php

    r4088 r4151  
    3838            'template',
    3939            'buddybar',
     40            'adminbar',
    4041            'functions',
    4142            'notifications',
  • trunk/bp-messages/bp-messages-loader.php

    r3964 r4151  
    153153        }
    154154
     155        parent::_setup_nav( $main_nav, $sub_nav );
     156    }
     157
     158    /**
     159     * Set up the admin bar
     160     *
     161     * @global obj $bp
     162     */
     163    function _setup_admin_bar() {
     164        global $bp;
     165
     166        // "My Account" menu
     167        if ( is_user_logged_in() ) {
     168
     169            // Setup the logged in user variables
     170            $user_domain   = $bp->loggedin_user->domain;
     171            $messages_link = trailingslashit( $user_domain . $this->slug );
     172
     173            // Unread message count
     174            if ( $count = messages_get_unread_count() ) {
     175                $title = sprintf( __( 'Messages <strong>(%s)</strong>', 'buddypress' ), $count );
     176                $inbox = sprintf( __( 'Inbox <strong>(%s)</strong>',    'buddypress' ), $count );
     177            } else {
     178                $title = __( 'Messages', 'buddypress' );
     179                $inbox = __( 'Inbox',    'buddypress' );
     180            }
     181
     182            // Add main Messages menu
     183            $wp_admin_nav[] = array(
     184                'parent' => $bp->my_account_menu_id,
     185                'id'     => 'my-account-' . $this->id,
     186                'title'  => $title,
     187                'href'   => trailingslashit( $messages_link )
     188            );
     189
     190            // Inbox
     191            $wp_admin_nav[] = array(
     192                'parent' => 'my-account-' . $this->id,
     193                'title'  => $inbox,
     194                'href'   => trailingslashit( $messages_link . 'inbox' )
     195            );
     196
     197            // Sent Messages
     198            $wp_admin_nav[] = array(
     199                'parent' => 'my-account-' . $this->id,
     200                'title'  => __( 'Sent', 'buddypress' ),
     201                'href'   => trailingslashit( $messages_link . 'sent' )
     202            );
     203
     204            // Compose Message
     205            $wp_admin_nav[] = array(
     206                'parent' => 'my-account-' . $this->id,
     207                'title'  => __( 'Compose', 'buddypress' ),
     208                'href'   => trailingslashit( $messages_link . 'compose' )
     209            );
     210
     211            // Site Wide Notices
     212            if ( is_super_admin() ) {
     213                $wp_admin_nav[] = array(
     214                    'parent' => 'my-account-' . $this->id,
     215                    'title'  => __( 'All Member Notices', 'buddypress' ),
     216                    'href'   => trailingslashit( $messages_link . 'notices' )
     217                );
     218            }
     219        }
     220
     221        parent::_setup_admin_bar( $wp_admin_nav );
     222    }
     223
     224    /**
     225     * Sets up the title for pages and <title>
     226     *
     227     * @global obj $bp
     228     */
     229    function _setup_title() {
     230        global $bp;
     231
    155232        if ( bp_is_messages_component() ) {
    156233            if ( bp_is_my_profile() ) {
     
    165242        }
    166243
    167         parent::_setup_nav( $main_nav, $sub_nav );
     244        parent::_setup_title();
    168245    }
    169246}
  • trunk/bp-settings/bp-settings-loader.php

    r3917 r4151  
    116116        parent::_setup_nav( $main_nav, $sub_nav );
    117117    }
     118
     119    /**
     120     * Set up the admin bar
     121     *
     122     * @global obj $bp
     123     */
     124    function _setup_admin_bar() {
     125        global $bp;
     126
     127        // "My Account" menu
     128        if ( is_user_logged_in() ) {
     129
     130            // Setup the logged in user variables
     131            $user_domain   = $bp->loggedin_user->domain;
     132            $settings_link = trailingslashit( $user_domain . $this->slug );
     133
     134            // Add main Settings menu
     135            $wp_admin_nav[] = array(
     136                'parent' => $bp->my_account_menu_id,
     137                'id'     => 'my-account-' . $this->id,
     138                'title'  => __( 'Settings', 'buddypress' ),
     139                'href'   => trailingslashit( $settings_link )
     140            );
     141
     142            // General Account
     143            $wp_admin_nav[] = array(
     144                'parent' => 'my-account-' . $this->id,
     145                'title'  => __( 'General', 'buddypress' ),
     146                'href'   => trailingslashit( $settings_link . 'general' )
     147            );
     148
     149            // Notifications
     150            $wp_admin_nav[] = array(
     151                'parent' => 'my-account-' . $this->id,
     152                'title'  => __( 'Notifications', 'buddypress' ),
     153                'href'   => trailingslashit( $settings_link . 'notifications' )
     154            );
     155
     156            // Delete Account
     157            if ( !is_super_admin() && empty( $bp->site_options['bp-disable-account-deletion'] ) ) {
     158                $wp_admin_nav[] = array(
     159                    'parent' => 'my-account-' . $this->id,
     160                    'title'  => __( 'Compose', 'buddypress' ),
     161                    'href'   => trailingslashit( $settings_link . 'delete-account' )
     162                );
     163            }
     164        }
     165
     166        parent::_setup_admin_bar( $wp_admin_nav );
     167    }
    118168}
    119169// Create the settingss component
  • trunk/bp-xprofile/bp-xprofile-loader.php

    r3949 r4151  
    152152
    153153    /**
     154     * Set up the admin bar
     155     *
     156     * @global obj $bp
     157     */
     158    function _setup_admin_bar() {
     159        global $bp;
     160
     161        // Menus for logged in user
     162        if ( is_user_logged_in() ) {
     163
     164            // Profile link
     165            $profile_link = trailingslashit( $bp->loggedin_user->domain . $this->slug );
     166
     167            // Add the "Profile" sub menu
     168            $wp_admin_nav[] = array(
     169                'parent' => $bp->my_account_menu_id,
     170                'id'     => 'my-account-' . $this->id,
     171                'title'  => __( 'Profile', 'buddypress' ),
     172                'href'   => trailingslashit( $profile_link )
     173            );
     174
     175            // View Profile
     176            $wp_admin_nav[] = array(
     177                'parent' => 'my-account-' . $this->id,
     178                'title'  => __( 'View My Profile', 'buddypress' ),
     179                'href'   => trailingslashit( $profile_link . 'public' )
     180            );
     181
     182            // Edit Profile
     183            $wp_admin_nav[] = array(
     184                'parent' => 'my-account-' . $this->id,
     185                'title'  => __( 'Edit My Profile', 'buddypress' ),
     186                'href'   => trailingslashit( $profile_link . 'edit' )
     187            );
     188
     189            // Edit Profile
     190            $wp_admin_nav[] = array(
     191                'parent' => 'my-account-' . $this->id,
     192                'title'  => __( 'Change My Avatar', 'buddypress' ),
     193                'href'   => trailingslashit( $profile_link . 'change-avatar' )
     194            );
     195
     196        }
     197
     198        parent::_setup_admin_bar( $wp_admin_nav );
     199    }
     200
     201    /**
    154202     * Sets up the title for pages and <title>
    155203     *
Note: See TracChangeset for help on using the changeset viewer.