bp_get_profile_group_tabs

Return the XProfile group tabs.

Description

(string) bp_get_profile_group_tabs(); 

Returns (string)


Usage

  1. if ( !function_exists( 'bp_get_profile_group_tabs' ) ) { 
  2. require_once ABSPATH . PLUGINDIR . 'buddypress/bp-xprofile/bp-xprofile-template.php'; 
  3.  
  4.  
  5. // NOTICE! Understand what this does before running. 
  6. $result = bp_get_profile_group_tabs(); 
  7.  

Defined (1)

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

/bp-xprofile/bp-xprofile-template.php  
  1. function bp_get_profile_group_tabs() { 
  2.  
  3. // Get field group data. 
  4. $group_name = bp_get_profile_group_name(); 
  5. $tabs = array(); 
  6.  
  7. // Loop through field groups and put a tab-lst together. 
  8. for ( $i = 0, $count = count( $groups ); $i < $count; ++$i ) { 
  9.  
  10. // Setup the selected class. 
  11. $selected = ''; 
  12. if ( $group_name === $groups[ $i ]->name ) { 
  13. $selected = ' class="current"'; 
  14.  
  15. // Skip if group has no fields. 
  16. if ( empty( $groups[ $i ]->fields ) ) { 
  17. continue; 
  18.  
  19. // Build the profile field group link. 
  20. $link = trailingslashit( bp_displayed_user_domain() . bp_get_profile_slug() . '/edit/group/' . $groups[ $i ]->id ); 
  21.  
  22. // Add tab to end of tabs array. 
  23. $tabs[] = sprintf( 
  24. '<li %1$s><a href="%2$s">%3$s</a></li>',  
  25. $selected,  
  26. esc_url( $link ),  
  27. ); 
  28.  
  29. /** 
  30. * Filters the tabs to display for profile field groups. 
  31. * @since 1.5.0 
  32. * @param array $tabs Array of tabs to display. 
  33. * @param array $groups Array of profile groups. 
  34. * @param string $group_name Name of the current group displayed. 
  35. */ 
  36. $tabs = apply_filters( 'xprofile_filter_profile_group_tabs', $tabs, $groups, $group_name ); 
  37.  
  38. return join( '', $tabs );