bp_nouveau_admin_bar_member_dashboard( array $wp_admin_nav = array() )

Adds a ‘Dashbaord’ link in admin bar.

Description

Parameters

$wp_admin_nav

(Optional)

Default value: array()

Return

(void)

Source

File: bp-templates/bp-nouveau/includes/members/functions.php

function bp_nouveau_admin_bar_member_dashboard ( $wp_admin_nav = array() ) {
    if ( !bp_loggedin_user_id() ) {
        return false;
    }

	if ( bp_nouveau_get_appearance_settings( 'user_front_page' ) ) {

		$page_ids = bp_core_get_directory_page_ids();

		$profile_dashboard   = isset( $page_ids['profile_dashboard'] ) ? $page_ids['profile_dashboard'] : false;

		if ( $profile_dashboard > 0 ) {
			$dashboard_link = get_permalink( $profile_dashboard );

			// Add main Dashboard menu.
			$wp_admin_nav[] = array(
				'parent' => buddypress()->my_account_menu_id,
				'id'     => 'my-account-front',
				'title'  => __( 'Dashboard', 'buddyboss' ),
				'href'   => $dashboard_link,
			);

			// View sub menu.
			$wp_admin_nav[] = array(
				'parent'   => 'my-account-front',
				'id'       => 'my-account-front-view',
				'title'    => __( 'View', 'buddyboss' ),
				'href'     => $dashboard_link,
				'position' => 10
			);

			// Define the WordPress global.
			global $wp_admin_bar;

			// Add each admin menu.
			foreach ( $wp_admin_nav as $admin_menu ) {
				$wp_admin_bar->add_menu( $admin_menu );
			}
		}
	}
}

Changelog

Changelog
Version Description
BuddyBoss 1.0.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.