bp_core_get_admin_tabs( string $active_tab = '', string $context = 'settings' )

Get the data for the tabs in the admin area.


Parameters Parameters

$active_tab

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

Default value: ''

$context

(string) (Optional) The context of use for the tabs. Defaults to 'settings'. Possible values are 'settings' & 'tools'.

Default value: 'settings'


Top ↑

Return Return

(string)


Source Source

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

function bp_core_get_admin_tabs( $active_tab = '', $context = 'settings' ) {
	$tabs = array();

	if ( 'settings' === $context ) {
		$tabs = array(
			'0' => array(
				'href' => bp_get_admin_url( add_query_arg( array( 'page' => 'bp-components' ), 'admin.php' ) ),
				'name' => __( 'Components', 'buddypress' ),
			),
			'2' => array(
				'href' => bp_get_admin_url( add_query_arg( array( 'page' => 'bp-settings' ), 'admin.php' ) ),
				'name' => __( 'Options', 'buddypress' ),
			),
			'1' => array(
				'href' => bp_get_admin_url( add_query_arg( array( 'page' => 'bp-page-settings' ), 'admin.php' ) ),
				'name' => __( 'Pages', 'buddypress' ),
			),
			'3' => array(
				'href' => bp_get_admin_url( add_query_arg( array( 'page' => 'bp-credits' ), 'admin.php' ) ),
				'name' => __( 'Credits', 'buddypress' ),
			),
		);
	} elseif ( 'tools' === $context ) {
		$tools_page = 'tools.php';
		if ( bp_core_do_network_admin() ) {
			$tools_page = 'admin.php';
		}

		$tabs = array(
			'0' => array(
				'href' => bp_get_admin_url( add_query_arg( array( 'page' => 'bp-tools' ), $tools_page ) ),
				'name' => __( 'Repair', 'buddypress' ),
			),
			'1' => array(
				'href' => bp_get_admin_url( add_query_arg( array( 'page' => 'bp-members-invitations' ), $tools_page ) ),
				'name' => __( 'Manage Invitations', 'buddypress' ),
			),
			'2' => array(
				'href' => bp_get_admin_url( add_query_arg( array( 'page' => 'bp-optouts' ), $tools_page ) ),
				'name' => __( 'Manage Opt-outs', 'buddypress' ),
			),
		);
	}

	/**
	 * Filters the tab data used in our wp-admin screens.
	 *
	 * @since 2.2.0
	 * @since 8.0.0 Adds the `$context` parameter.
	 *
	 * @param array  $tabs    Tab data.
	 * @param string $context The context of use for the tabs.
	 */
	return apply_filters( 'bp_core_get_admin_tabs', $tabs, $context );
}


Top ↑

Changelog Changelog

Changelog
Version Description
8.0.0 Adds the $context parameter.
2.2.0 Introduced.

Top ↑

User Contributed Notes User Contributed Notes

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