BP_REST_Groups_Details_Endpoint::bp_rest_legacy_get_groups_directory_nav_items()
Legacy template group directory navigation support added.
Description
Return
(mixed|void)
Source
File: bp-groups/classes/class-bp-rest-groups-details-endpoint.php
public function bp_rest_legacy_get_groups_directory_nav_items(){
$nav_items = array();
$nav_items['all'] = array(
'text' => __( 'All Groups', 'buddyboss' ),
'slug' => 'all',
'count' => bp_get_total_group_count(),
'position' => 5,
);
if ( is_user_logged_in() ) {
$my_groups_count = bp_get_total_group_count_for_user( bp_loggedin_user_id() );
// If the user has groups create a nav item
if ( $my_groups_count ) {
$nav_items['personal'] = array(
'text' => __( 'My Groups', 'buddyboss' ),
'slug' => 'personal', // slug is used because BP_Core_Nav requires it, but it's the scope
'count' => $my_groups_count,
'position' => 15,
);
}
// If the user can create groups, add the create nav
if ( bp_user_can_create_groups() ) {
$nav_items['create'] = array(
'text' => __( 'Create a Group', 'buddyboss' ),
'slug' => 'create', // slug is used because BP_Core_Nav requires it, but it's the scope
'count' => false,
'position' => 999,
);
}
}
return apply_filters( 'bp_rest_legacy_get_groups_directory_nav_items', $nav_items );
}
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.