BP_REST_Members_Details_Endpoint::get_profile_navigation( boolean $default )

Get the profile dropdown navigation based on the current user.

Description

Parameters

$default

(Required) which menu you have to retrieve.

Return

(array|mixed|null)

Source

File: bp-members/classes/class-bp-rest-members-details-endpoint.php

	public function get_profile_navigation( $default ) {

		if ( function_exists( 'bp_is_active' ) && ! empty( $default ) ) {
			if ( has_nav_menu( 'header-my-account' ) ) {
				$menu = wp_nav_menu(
					array(
						'theme_location' => 'header-my-account',
						'echo'           => false,
						'fallback_cb'    => '__return_false',
					)
				);
				if ( ! empty( $menu ) ) {
					$locations  = get_nav_menu_locations();
					$menu       = wp_get_nav_menu_object( $locations['header-my-account'] );
					$menu_items = wp_get_nav_menu_items( $menu->term_id );
					return $this->bp_rest_build_tree( $menu_items, 0 );

				} else {
					return $this->bp_rest_default_menu();
				}
			} else {
				return $this->bp_rest_default_menu();
			}
		} else {
			return $this->bp_rest_default_menu();
		}
	}

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.