Skip to:
Content

BuddyPress.org


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