bp_nouveau_get_members_directory_nav_items()

Get the nav items for the Members directory

Description

Return

(array) An associative array of nav items.

Source

File: bp-templates/bp-nouveau/includes/members/functions.php

19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
function bp_nouveau_get_members_directory_nav_items() {
    $nav_items = array();
 
    $nav_items['all'] = array(
        'component' => 'members',
        'slug'      => 'all', // slug is used because BP_Core_Nav requires it, but it's the scope
        'li_class'  => array(),
        'link'      => bp_get_members_directory_permalink(),
        'text'      => __( 'All Members', 'buddyboss' ),
        'count'     => bp_get_total_member_count(),
        'position'  => 5,
    );
 
    if ( is_user_logged_in() ) {
        // If friends component is active and the user has friends
        if ( bp_is_active( 'friends' ) && bp_get_total_friend_count( bp_loggedin_user_id() ) ) {
            $nav_items['personal'] = array(
                'component' => 'members',
                '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_friends_slug() . '/my-friends/',
                'text'      => __( 'My Connections', 'buddyboss' ),
                'count'     => bp_get_total_friend_count( bp_loggedin_user_id() ),
                'position'  => 15,
            );
        }
 
        // If follow component is active and the user is following
        if ( bp_is_active( 'activity' ) && bp_is_activity_follow_active() ) {
            $counts = bp_total_follow_counts();
 
            if ( ! empty( $counts['following'] ) ) {
                $nav_items['following'] = array(
                    'component' => 'members',
                    'slug'      => 'following', // slug is used because BP_Core_Nav requires it, but it's the scope
                    'li_class'  => array(),
                    'link'      => bp_loggedin_user_domain() . bp_get_follow_slug() . '/my-following/',
                    'text'      => __( 'Following', 'buddyboss' ),
                    'count'     => $counts['following'],
                    'position'  => 16,
                );
            }
        }
    }
 
    // Check for the deprecated hook :
    $extra_nav_items = bp_nouveau_parse_hooked_dir_nav( 'bp_members_directory_member_types', 'members', 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 members directory.
     *
     * @since BuddyPress 3.0.0
     *
     * @param array $nav_items The list of the members directory nav items.
     */
    return apply_filters( 'bp_nouveau_get_members_directory_nav_items', $nav_items );
}

Changelog

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.