Skip to:
Content

BuddyPress.org


Ignore:
Timestamp:
03/24/2011 05:26:18 AM (15 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.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • 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
Note: See TracChangeset for help on using the changeset viewer.