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

	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.