bp_nouveau_get_groups_directory_nav_items()
Description Description
Source Source
File: bp-templates/bp-nouveau/includes/groups/functions.php
function bp_nouveau_get_groups_directory_nav_items() {
$nav_items = array();
$nav_items['all'] = array(
'component' => 'groups',
'slug' => 'all', // slug is used because BP_Core_Nav requires it, but it's the scope
'li_class' => array( 'selected' ),
'link' => bp_get_groups_directory_permalink(),
'text' => __( 'All Groups', 'buddypress' ),
'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(
'component' => 'groups',
'slug' => 'personal', // slug is used because BP_Core_Nav requires it, but it's the scope
'li_class' => array(),
'link' => bp_loggedin_user_domain() . bp_get_groups_slug() . '/my-groups/',
'text' => __( 'My Groups', 'buddypress' ),
'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(
'component' => 'groups',
'slug' => 'create', // slug is used because BP_Core_Nav requires it, but it's the scope
'li_class' => array( 'no-ajax', 'group-create', 'create-button' ),
'link' => trailingslashit( bp_get_groups_directory_permalink() . 'create' ),
'text' => __( 'Create a Group', 'buddypress' ),
'count' => false,
'position' => 999,
);
}
}
// Check for the deprecated hook :
$extra_nav_items = bp_nouveau_parse_hooked_dir_nav( 'bp_groups_directory_group_filter', 'groups', 20 );
if ( ! empty( $extra_nav_items ) ) {
$nav_items = array_merge( $nav_items, $extra_nav_items );
}
/**
* Use this filter to introduce your custom nav items for the groups directory.
*
* @since 3.0.0
*
* @param array $nav_items The list of the groups directory nav items.
*/
return apply_filters( 'bp_nouveau_get_groups_directory_nav_items', $nav_items );
}
Changelog Changelog
| Version | Description |
|---|---|
| 3.0.0 | Introduced. |