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

    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.