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

Set up the Admin Bar.

Description

Parameters

$wp_admin_nav

(Optional) Admin Bar items.

Default value: array()

Source

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

362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
public function setup_admin_bar( $wp_admin_nav = array() ) {
 
    // Menus for logged in user.
    if ( is_user_logged_in() ) {
 
        // Profile link.
        $profile_link = trailingslashit( bp_loggedin_user_domain() . bp_get_profile_slug() );
 
        // Add the "Profile" sub menu.
        $wp_admin_nav[] = array(
            'parent' => buddypress()->my_account_menu_id,
            'id'     => 'my-account-' . $this->id,
            'title'  => __( 'Profile', 'buddyboss' ),
            'href'   => $profile_link
        );
 
        // View Profile.
        $wp_admin_nav[] = array(
            'parent'   => 'my-account-' . $this->id,
            'id'       => 'my-account-' . $this->id . '-public',
            'title'    => __( 'View', 'buddyboss' ),
            'href'     => $profile_link,
            'position' => 10
        );
 
        // Edit Profile.
        $wp_admin_nav[] = array(
            'parent'   => 'my-account-' . $this->id,
            'id'       => 'my-account-' . $this->id . '-edit',
            'title'    => __( 'Edit', 'buddyboss' ),
            'href'     => trailingslashit( $profile_link . 'edit' ),
            'position' => 20
        );
 
        // Edit Avatar.
        if ( buddypress()->avatar->show_avatars ) {
            $wp_admin_nav[] = array(
                'parent'   => 'my-account-' . $this->id,
                'id'       => 'my-account-' . $this->id . '-change-avatar',
                'title'    => __( 'Profile Photo', 'buddyboss' ),
                'href'     => trailingslashit( $profile_link . 'change-avatar' ),
                'position' => 30
            );
        }
 
        if ( bp_displayed_user_use_cover_image_header() ) {
            $wp_admin_nav[] = array(
                'parent'   => 'my-account-' . $this->id,
                'id'       => 'my-account-' . $this->id . '-change-cover-image',
                'title'    => __( 'Cover Photo', 'buddyboss' ),
                'href'     => trailingslashit( $profile_link . 'change-cover-image' ),
                'position' => 40
            );
        }
    }
 
    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.