BP_Activity_Component::setup_nav( array $main_nav = array(), array $sub_nav = array() )

Set up component navigation.

Description

See also

Parameters

$main_nav

(Optional) See BP_Component::setup_nav() for description.

Default value: array()

$sub_nav

(Optional) See BP_Component::setup_nav() for description.

Default value: array()

Source

File: bp-activity/classes/class-bp-activity-component.php

	public function setup_nav( $main_nav = array(), $sub_nav = array() ) {

		// Stop if there is no user displayed or logged in.
		if ( ! is_user_logged_in() && ! bp_displayed_user_id() ) {
			return;
		}

		// Determine user to use.
		if ( bp_displayed_user_domain() ) {
			$user_domain = bp_displayed_user_domain();
		} elseif ( bp_loggedin_user_domain() ) {
			$user_domain = bp_loggedin_user_domain();
		} else {
			return;
		}

		$slug          = bp_get_activity_slug();
		$activity_link = trailingslashit( $user_domain . $slug );

		$main_slug = ['just-me'];
		if ( bp_activity_do_mentions() )   $main_slug[] = 'mentions';
		if ( bp_is_active( 'friends' ) && bp_is_my_profile() )   $main_slug[] = 'friends';
		if ( bp_is_active( 'groups' ) && bp_is_my_profile() )    $main_slug[] = 'groups';
		if ( bp_is_activity_follow_active() && bp_is_my_profile() )    $main_slug[] = 'following';


		// Add 'Activity' to the main navigation.
		$main_nav = array(
			'name'                => __( 'Timeline', 'buddyboss' ),
			'slug'                => $slug,
			'position'            => 25,
			'screen_function'     => 'bp_activity_screen_my_activity',
			'default_subnav_slug' => implode( ',', $main_slug ),
			'item_css_id'         => $this->id
		);

		parent::setup_nav( $main_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.