BP_Settings_Component::setup_admin_bar( array $wp_admin_nav = array() )

Set up the Toolbar.

Description

Parameters

$wp_admin_nav

(Optional) Array of Admin Bar items.

Default value: array()

Source

File: bp-settings/classes/class-bp-settings-component.php

221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
public function setup_admin_bar( $wp_admin_nav = array() ) {
 
    // Menus for logged in user.
    if ( is_user_logged_in() ) {
 
        // Setup the logged in user variables.
        $settings_link = trailingslashit( bp_loggedin_user_domain() . bp_get_settings_slug() );
 
        // Add main Settings menu.
        $wp_admin_nav[] = array(
            'parent' => buddypress()->my_account_menu_id,
            'id'     => 'my-account-' . $this->id,
            'title'  => __( 'Account', 'buddyboss' ),
            'href'   => $settings_link
        );
 
        // General Account.
        $wp_admin_nav[] = array(
            'parent'   => 'my-account-' . $this->id,
            'id'       => 'my-account-' . $this->id . '-general',
            'title'    => __( 'Login Information', 'buddyboss' ),
            'href'     => $settings_link,
            'position' => 10
        );
 
        // Notifications - only add the tab when there is something to display there.
        if ( has_action( 'bp_notification_settings' ) ) {
            $wp_admin_nav[] = array(
                'parent'   => 'my-account-' . $this->id,
                'id'       => 'my-account-' . $this->id . '-notifications',
                'title'    => __( 'Email Preferences', 'buddyboss' ),
                'href'     => trailingslashit( $settings_link . 'notifications' ),
                'position' => 20
            );
        }
 
        $wp_admin_nav[] = array(
            'parent' => 'my-account-' . $this->id,
            'id'     => 'my-account-' . $this->id . '-export',
            'title'  => __( 'Export Data', 'buddyboss' ),
            'href'   => trailingslashit( $settings_link . 'export/' ),
            'position' => 50
        );
 
        // Delete Account
        if ( !bp_current_user_can( 'bp_moderate' ) && ! bp_core_get_root_option( 'bp-disable-account-deletion' ) ) {
            $wp_admin_nav[] = array(
                'parent'   => 'my-account-' . $this->id,
                'id'       => 'my-account-' . $this->id . '-delete-account',
                'title'    => __( 'Delete Account', 'buddyboss' ),
                'href'     => trailingslashit( $settings_link . 'delete-account' ),
                'position' => 90
            );
        }
    }
 
    parent::setup_admin_bar( $wp_admin_nav );
}

Changelog

Changelog
Version Description
BuddyPress 1.5.0 Introduced.

Questions?

We're always happy to help with code or other questions you might have! Search our developer docs, contact support, or connect with our sales team.