bp_nouveau_current_object()

Get the current component or action.


Description Description

If on single group screens we need to switch from component to bp_current_action() to add the correct IDs/labels for group/activity & similar screens.


Source Source

File: bp-templates/bp-nouveau/includes/template-tags.php

function bp_nouveau_current_object() {
	/*
	 * If we're looking at groups single screens we need to factor in current action
	 * to avoid the component check adding the wrong id for the main dir e.g 'groups' instead of 'activity'.
	 * We also need to check for group screens to adjust the id's for prefixes.
	 */
	$component = array();

	if ( bp_is_group() ) {
		$component['members_select']   = 'groups_members-order-select';
		$component['members_order_by'] = 'groups_members-order-by';
		$component['object']           = bp_current_action();
		$component['data_filter']      = bp_current_action();

		if ( 'activity' !== bp_current_action() ) {
			$component['data_filter'] = 'group_' . bp_current_action();
		}

	} else {
		$data_filter = bp_current_component();
		if ( 'friends' === $data_filter && bp_is_user_friend_requests() ) {
			$data_filter = 'friend_requests';
		}

		$component['members_select']   = 'members-order-select';
		$component['members_order_by'] = 'members-order-by';
		$component['object']           = bp_current_component();
		$component['data_filter']      = $data_filter;
	}

	return $component;
}

Top ↑

Changelog Changelog

Changelog
Version Description
3.0.0 Introduced.

Top ↑

User Contributed Notes User Contributed Notes

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