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

747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
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.