BP_Admin::admin_menus()

Register site- or network-admin nav menu elements.

Description

Contextually hooked to site or network-admin depending on current configuration.

Source

File: bp-core/classes/class-bp-admin.php

403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
    public function admin_menus() {
 
        global $menu;
 
        // Bail if user cannot moderate.
        if ( ! bp_current_user_can( 'manage_options' ) ) {
            return;
        }
 
        // Add BuddyBoss Menu separator above the BuddyBoss and below the BuddyBoss
        if ( bp_current_user_can( 'manage_options' ) ) {
            $menu[] = array( '', 'read', 'separator-buddyboss', '', 'wp-menu-separator buddyboss' ); // WPCS: override ok.
            $menu[] = array( '', 'read', 'separator-plugins', '', 'wp-menu-separator plugins' ); // WPCS: override ok.
        }
 
        $hooks = array();
 
        // Changed in BP 1.6 . See bp_core_admin_backpat_menu().
        $hooks[] = add_menu_page(
            __( 'BuddyBoss', 'buddyboss' ),
            __( 'BuddyBoss', 'buddyboss' ),
            $this->capability,
            $this->settings_page,
            'bp_core_admin_backpat_menu',
            buddypress()->plugin_url . 'bp-core/images/admin/icons/logos/buddyboss.svg',
            62
        );
 
        $hooks[] = add_submenu_page(
            'bp-general-settings',
            __( 'BuddyBoss Help', 'buddyboss' ),
            __( 'Help', 'buddyboss' ),
            $this->capability,
            'bp-general-settings',
            'bp_core_admin_backpat_page'
        );
 
        // Add the Separator.
//      $hooks[] = add_submenu_page(
//          $this->settings_page,
//          __( '', 'buddyboss' ),
//          __( '', 'buddyboss' ),
//          $this->capability,
//          'bp-plugin-separator-notice',
//          ''
//      );
 
        // Add the option pages.
        $hooks[] = add_submenu_page(
            $this->settings_page,
            __( 'BuddyBoss Components', 'buddyboss' ),
            __( 'Components', 'buddyboss' ),
            $this->capability,
            'bp-components',
            'bp_core_admin_components_settings'
        );
 
        $hooks[] = add_submenu_page(
            $this->settings_page,
            __( 'Pages', 'buddyboss' ),
            __( 'Pages', 'buddyboss' ),
            $this->capability,
            'bp-pages',
            'bp_core_admin_pages_settings'
        );
 
        $hooks[] = add_submenu_page(
            $this->settings_page,
            __( 'BuddyBoss Settings', 'buddyboss' ),
            __( 'Settings', 'buddyboss' ),
            $this->capability,
            'bp-settings',
            'bp_core_admin_settings'
        );
 
        $hooks[] = add_submenu_page(
            $this->settings_page,
            __( 'Plugin Integrations', 'buddyboss' ),
            __( 'Integrations', 'buddyboss' ),
            $this->capability,
            'bp-integrations',
            'bp_core_admin_integrations'
        );
 
        // Credits.
        $hooks[] = add_submenu_page(
            $this->settings_page,
            __( 'Credits', 'buddyboss' ),
            __( 'Credits', 'buddyboss' ),
            $this->capability,
            'bp-credits',
            array( $this, 'bp_credits_screen' )
        );
 
 
 
        // For consistency with non-Multisite, we add a Tools menu in
        // the Network Admin as a home for our Tools panel.
        if ( is_multisite() && bp_core_do_network_admin() ) {
            $tools_parent = 'network-tools';
 
            $hooks[] = add_menu_page(
                __( 'Tools', 'buddyboss' ),
                __( 'Tools', 'buddyboss' ),
                $this->capability,
                $tools_parent,
                'bp_core_tools_top_level_item',
                '',
                24 // Just above Settings.
            );
 
            $hooks[] = add_submenu_page(
                $tools_parent,
                __( 'Available Tools', 'buddyboss' ),
                __( 'Available Tools', 'buddyboss' ),
                $this->capability,
                'available-tools',
                'bp_core_admin_available_tools_page'
            );
        } else {
            $tools_parent = 'tools.php';
        }
 
        $hooks[] = add_submenu_page(
            $this->settings_page,
            __( 'Tools', 'buddyboss' ),
            __( 'Tools', 'buddyboss' ),
            $this->capability,
            'bp-tools',
            'bp_core_admin_tools'
        );
 
        $hooks[] = add_submenu_page(
            $this->settings_page,
            __( 'Help', 'buddyboss' ),
            __( 'Help', 'buddyboss' ),
            $this->capability,
            'bp-help',
            'bp_core_admin_help'
        );
 
        $hooks[] = add_submenu_page(
            $this->settings_page,
            __( '', 'buddyboss' ),
            __( '', 'buddyboss' ),
            $this->capability,
            'bp-plugin-separator-notice',
            ''
        );
 
        // For network-wide configs, add a link to (the root site's) Emails screen.
        if ( is_network_admin() && bp_is_network_activated() ) {
            $email_labels = bp_get_email_post_type_labels();
            $email_url    = get_admin_url( bp_get_root_blog_id(), 'edit.php?post_type=' . bp_get_email_post_type() );
 
            $hooks[] = add_menu_page(
                $email_labels['name'],
                $email_labels['menu_name'],
                $this->capability,
                '',
                '',
                'dashicons-email-alt',
                26
            );
 
            // Hack: change the link to point to the root site's admin, not the network admin.
            //$GLOBALS['menu'][26][2] = esc_url_raw( $email_url );
        }
 
        // foreach( $hooks as $hook ) {
        //  add_action( "admin_head-$hook", 'bp_core_modify_admin_menu_highlight' );
        // }
    }

Changelog

Changelog
Version Description
BuddyPress 1.6.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.