bp_nouveau_current_object()
Get the current component or action.
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
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 {
$component['members_select'] = 'members-order-select';
$component['members_order_by'] = 'members-order-by';
$component['object'] = bp_current_component();
$component['data_filter'] = bp_current_component();
}
return $component;
}
Changelog
| Version | Description |
|---|---|
| BuddyPress 3.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.