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

Set up the Admin Bar.


Description Description


Parameters Parameters

$wp_admin_nav

(Optional) Admin Bar items.

Default value: array()


Top ↑

Source 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'  => _x( 'Profile', 'My Account Profile', 'buddypress' ),
				'href'   => $profile_link
			);

			// View Profile.
			$wp_admin_nav[] = array(
				'parent'   => 'my-account-' . $this->id,
				'id'       => 'my-account-' . $this->id . '-public',
				'title'    => _x( 'View', 'My Account Profile sub nav', 'buddypress' ),
				'href'     => $profile_link,
				'position' => 10
			);

			// Edit Profile.
			$wp_admin_nav[] = array(
				'parent'   => 'my-account-' . $this->id,
				'id'       => 'my-account-' . $this->id . '-edit',
				'title'    => _x( 'Edit', 'My Account Profile sub nav', 'buddypress' ),
				'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'    => _x( 'Change Profile Photo', 'My Account Profile sub nav', 'buddypress' ),
					'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'    => _x( 'Change Cover Image', 'My Account Profile sub nav', 'buddypress' ),
					'href'     => trailingslashit( $profile_link . 'change-cover-image' ),
					'position' => 40
				);
			}
		}

		parent::setup_admin_bar( $wp_admin_nav );
	}

Top ↑

Changelog Changelog

Changelog
Version Description
1.5.0 Introduced.

Top ↑

User Contributed Notes User Contributed Notes

You must log in before being able to contribute a note or feedback.