BP_Core_BP_Nav_BackCompat::get_component( mixed $offset = '' )

Get the component to which the a nav item belongs.

Description

We use the following heuristic to guess, based on an offset, which component the item belongs to:

  • If this is a group, and the offset is the same as the current group’s slug, it’s a group nav item.
  • Otherwise, it’s a member nav item.

Parameters

$offset

(Optional) Array offset.

Default value: ''

Return

(string|array)

Source

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

	public function get_component( $offset = '' ) {
		if ( ! isset( $this->component ) ) {
			if ( bp_is_active( 'groups' ) && $offset === bp_get_current_group_slug() ) {
				$this->component = 'groups';
			} else {
				$this->component = 'members';
			}
		}

		return $this->component;
	}

Changelog

Changelog
Version Description
BuddyPress 2.6.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.