bp_nouveau_get_activity_directory_nav_items()

Get activity directory navigation menu items.

Description

Source

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

226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
function bp_nouveau_get_activity_directory_nav_items() {
    $nav_items = array();
 
    $nav_items['all'] = array(
        'component' => 'activity',
        'slug'      => 'all', // slug is used because BP_Core_Nav requires it, but it's the scope
        'li_class'  => array( 'dynamic' ),
        'link'      => bp_get_activity_directory_permalink(),
        'text'      => __( 'All Updates', 'buddyboss' ),
        'count'     => false,
        'position'  => 5,
    );
 
    // deprecated hooks
    $deprecated_hooks = array(
        array( 'bp_before_activity_type_tab_all', 'activity', 0 ),
        array( 'bp_activity_type_tabs', 'activity', 46 ),
    );
 
    if ( is_user_logged_in() ) {
        $deprecated_hooks = array_merge(
            $deprecated_hooks,
            array(
                array( 'bp_before_activity_type_tab_friends', 'activity', 6 ),
                array( 'bp_before_activity_type_tab_groups', 'activity', 16 ),
                array( 'bp_before_activity_type_tab_favorites', 'activity', 26 ),
            )
        );
 
        // If the user has favorite create a nav item
        if ( bp_get_total_favorite_count_for_user( bp_loggedin_user_id() ) && bp_is_activity_like_active() ) {
            $nav_items['favorites'] = array(
                'component' => 'activity',
                'slug'      => 'favorites', // slug is used because BP_Core_Nav requires it, but it's the scope
                'li_class'  => array(),
                'link'      => bp_loggedin_user_domain() . bp_get_activity_slug() . '/favorites/',
                'text'      => __( 'My Likes', 'buddyboss' ),
                'count'     => false,
                'position'  => 35,
            );
        }
    }
 
    // Check for deprecated hooks :
    foreach ( $deprecated_hooks as $deprectated_hook ) {
        list( $hook, $component, $position ) = $deprectated_hook;
 
        $extra_nav_items = bp_nouveau_parse_hooked_dir_nav( $hook, $component, $position );
 
        if ( ! empty( $extra_nav_items ) ) {
            $nav_items = array_merge( $nav_items, $extra_nav_items );
        }
    }
 
    /**
     * Filters the activity directory navigation items.
     *
     * Use this filter to introduce your custom nav items for the activity directory.
     *
     * @since BuddyPress 3.0.0
     *
     * @param array $nav_items The list of the activity directory nav items.
     */
    return apply_filters( 'bp_nouveau_get_activity_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.