bp_core_tools_settings_admin_tabs( string $active_tab = '' )

Output the settings tabs in the admin area.

Description

Parameters

$active_tab

(Optional) Name of the tab that is active. Optional.

Default value: ''

Source

File: bp-core/admin/bp-core-admin-functions.php

2771
2772
2773
2774
2775
2776
2777
2778
2779
2780
2781
2782
2783
2784
2785
2786
2787
2788
2789
2790
2791
2792
2793
2794
2795
2796
2797
2798
2799
2800
2801
2802
2803
2804
2805
2806
2807
2808
2809
2810
2811
2812
function bp_core_tools_settings_admin_tabs( $active_tab = '' ) {
 
    $tabs_html    = '';
    $idle_class   = '';
    $active_class = 'current';
    $active_tab   = isset( $_GET['tab'] ) ? $_GET['tab'] : 'bp-tools';
 
    /**
     * Filters the admin tabs to be displayed.
     *
     * @since BuddyPress 1.9.0
     *
     * @param array $value Array of tabs to output to the admin area.
     */
    $tabs         = apply_filters( 'bp_core_tools_settings_admin_tabs', bp_core_get_tools_settings_admin_tabs( $active_tab ) );
 
    $count = count( array_values( $tabs ) );
    $i     = 1;
 
    // Loop through tabs and build navigation.
    foreach ( array_values( $tabs ) as $tab_data ) {
 
        $is_current = (bool) ( $tab_data['slug'] == $active_tab );
        $tab_class  = $is_current ? $active_class : $idle_class;
        if ( $i === $count ) {
            $tabs_html .= '<li><a href="' . esc_url( $tab_data['href'] ) . '" class="' . esc_attr( $tab_class ) . '">' . esc_html( $tab_data['name'] ) . '</a></li>';
        } else {
            $tabs_html .= '<li><a href="' . esc_url( $tab_data['href'] ) . '" class="' . esc_attr( $tab_class ) . '">' . esc_html( $tab_data['name'] ) . '</a> |</li>';
        }
 
        $i = $i + 1;
    }
 
    echo $tabs_html;
 
    /**
     * Fires after the output of tabs for the admin area.
     *
     * @since BuddyPress 1.5.0
     */
    do_action( 'bp_tools_settings_admin_tabs' );
}

Changelog

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