bbp_get_tools_admin_tabs

Output the tabs in the admin area.

Description

bbp_get_tools_admin_tabs( (string) $active_tab = '' ); 

Parameters (1)

0. $active_tab — Optional. (string) => ''
Name of the tab that is active

Usage

  1. if ( !function_exists( 'bbp_get_tools_admin_tabs' ) ) { 
  2. require_once ABSPATH . PLUGINDIR . 'bbpress/includes/admin/functions.php'; 
  3.  
  4. // Name of the tab that is active 
  5. $active_tab = ''; 
  6.  
  7. // NOTICE! Understand what this does before running. 
  8. $result = bbp_get_tools_admin_tabs($active_tab); 
  9.  

Defined (1)

The function is defined in the following location(s).

/includes/admin/functions.php  
  1. function bbp_get_tools_admin_tabs( $active_tab = '' ) { 
  2.  
  3. // Declare local variables 
  4. $tabs_html = ''; 
  5. $idle_class = 'nav-tab'; 
  6. $active_class = 'nav-tab nav-tab-active'; 
  7.  
  8. // Setup core admin tabs 
  9. $tabs = apply_filters( 'bbp_tools_admin_tabs', array( 
  10. '0' => array( 
  11. 'href' => get_admin_url( '', add_query_arg( array( 'page' => 'bbp-repair' ), 'tools.php' ) ),  
  12. 'name' => __( 'Repair Forums', bbpress ) 
  13. ),  
  14. '1' => array( 
  15. 'href' => get_admin_url( '', add_query_arg( array( 'page' => 'bbp-converter' ), 'tools.php' ) ),  
  16. 'name' => __( 'Import Forums', bbpress ) 
  17. ),  
  18. '2' => array( 
  19. 'href' => get_admin_url( '', add_query_arg( array( 'page' => 'bbp-reset' ), 'tools.php' ) ),  
  20. 'name' => __( 'Reset Forums', bbpress ) 
  21. ) ); 
  22.  
  23. // Loop through tabs and build navigation 
  24. foreach ( array_values( $tabs ) as $tab_data ) { 
  25. $is_current = (bool) ( $tab_data['name'] == $active_tab ); 
  26. $tab_class = $is_current ? $active_class : $idle_class; 
  27. $tabs_html .= '<a href="' . esc_url( $tab_data['href'] ) . '" class="' . esc_attr( $tab_class ) . '">' . esc_html( $tab_data['name'] ) . '</a>'; 
  28.  
  29. // Output the tabs 
  30. return $tabs_html;