BP_Forums_Component::setup_admin_bar( $wp_admin_nav = array() )

Set up the admin bar

Description

Source

File: bp-forums/classes/class-bp-forums-component.php

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
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
public function setup_admin_bar( $wp_admin_nav = array() ) {
 
    // Menus for logged in user
    if ( is_user_logged_in() ) {
 
        // Setup the logged in user variables
        $user_domain = bp_loggedin_user_domain();
        $forums_link = trailingslashit( $user_domain . $this->slug );
 
        // Add the "My Account" sub menus
        $wp_admin_nav[] = array(
            'parent' => buddypress()->my_account_menu_id,
            'id'     => 'my-account-' . $this->id,
            'title'  => __( 'Forums', 'buddyboss' ),
            'href'   => trailingslashit( $forums_link )
        );
 
        // Topics
        $wp_admin_nav[] = array(
            'parent' => 'my-account-' . $this->id,
            'id'     => 'my-account-' . $this->id . '-topics',
            'title'  => __( 'My Discussions', 'buddyboss' ),
            'href'   => trailingslashit( $forums_link . bbp_get_topic_archive_slug() )
        );
 
        // Replies
        $wp_admin_nav[] = array(
            'parent' => 'my-account-' . $this->id,
            'id'     => 'my-account-' . $this->id . '-replies',
            'title'  => __( 'My Replies', 'buddyboss' ),
            'href'   => trailingslashit( $forums_link . bbp_get_reply_archive_slug() )
        );
 
        // Favorites
        $wp_admin_nav[] = array(
            'parent' => 'my-account-' . $this->id,
            'id'     => 'my-account-' . $this->id . '-favorites',
            'title'  => __( 'My Favorites', 'buddyboss' ),
            'href'   => trailingslashit( $forums_link . bbp_get_user_favorites_slug() )
        );
 
        // Subscriptions
        $wp_admin_nav[] = array(
            'parent' => 'my-account-' . $this->id,
            'id'     => 'my-account-' . $this->id . '-subscriptions',
            'title'  => __( 'Subscriptions', 'buddyboss' ),
            'href'   => trailingslashit( $forums_link . bbp_get_user_subscriptions_slug() )
        );
    }
 
    parent::setup_admin_bar( $wp_admin_nav );
}

Changelog

Changelog
Version Description
bbPress (r3552) 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.