BP_Core_BP_Nav_BackCompat::get_component_nav( string $offset = '' )

Get the BP_Core_Nav object corresponding to the component, based on a nav item name.


Description Description

The way bp_nav was previously organized makes it impossible to know for sure which component’s nav is being referenced by a given nav item name. We guess in the following manner:

  • If we’re looking at a group, and the nav item name ($offset) is the same as the slug of the current group, we assume that the proper component nav is ‘groups’.
  • Otherwise, fall back on ‘members’.

Parameters Parameters

$offset

(Optional) Nav item name.

Default value: ''


Top ↑

Return Return

(BP_Core_Nav)


Top ↑

Source Source

File: bp-core/classes/class-bp-core-bp-nav-backcompat.php

	protected function get_component_nav( $offset = '' ) {
		$component = $this->get_component( $offset );

		$bp = buddypress();
		if ( ! isset( $bp->{$component}->nav ) ) {
			return false;
		}

		return $bp->{$component}->nav;
	}

Top ↑

Changelog Changelog

Changelog
Version Description
2.6.0 Introduced.

Top ↑

User Contributed Notes User Contributed Notes

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