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

Set up bp-blogs integration with the WordPress admin bar.


Description Description

See also See also


Top ↑

Parameters Parameters

$wp_admin_nav

(Optional) See BP_Component::setup_admin_bar() for description.

Default value: array()


Top ↑

Return Return

(bool)


Top ↑

Source Source

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

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
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
public function setup_admin_bar( $wp_admin_nav = array() ) {
 
    /**
     * Site/post/comment menus should not appear on single WordPress setups.
     *
     * Comments and posts made by users will still show in their activity.
     */
    if ( ! is_multisite() ) {
        return false;
    }
 
    // Menus for logged in user.
    if ( is_user_logged_in() ) {
 
        // Setup the logged in user variables.
        $blogs_link = trailingslashit( bp_loggedin_user_domain() . bp_get_blogs_slug() );
 
        // Add the "Sites" sub menu.
        $wp_admin_nav[] = array(
            'parent' => buddypress()->my_account_menu_id,
            'id'     => 'my-account-' . $this->id,
            'title'  => __( 'Sites', 'buddypress' ),
            'href'   => $blogs_link
        );
 
        // My Sites.
        $wp_admin_nav[] = array(
            'parent'   => 'my-account-' . $this->id,
            'id'       => 'my-account-' . $this->id . '-my-sites',
            'title'    => __( 'My Sites', 'buddypress' ),
            'href'     => $blogs_link,
            'position' => 10
        );
 
        // Create a Site.
        if ( bp_blog_signup_enabled() ) {
            $wp_admin_nav[] = array(
                'parent'   => 'my-account-' . $this->id,
                'id'       => 'my-account-' . $this->id . '-create',
                'title'    => __( 'Create a Site', 'buddypress' ),
                'href'     => trailingslashit( bp_get_blogs_directory_permalink() . 'create' ),
                'position' => 99
            );
        }
    }
 
    parent::setup_admin_bar( $wp_admin_nav );
}

Top ↑

Changelog Changelog

Changelog
Version Description
1.5.0 Introduced.

Top ↑

User Contributed Notes User Contributed Notes

You must log in before being able to contribute a note or feedback.