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