bp_get_profile_group_tabs()
Return the XProfile group tabs.
Description
Return
(string)
Source
File: bp-xprofile/bp-xprofile-template.php
function bp_get_profile_group_tabs() {
// Get field group data.
$groups = bp_profile_get_field_groups();
$group_name = bp_get_profile_group_name();
$tabs = array();
// Loop through field groups and put a tab-lst together.
for ( $i = 0, $count = count( $groups ); $i < $count; ++$i ) {
// Setup the selected class.
$selected = '';
if ( $group_name === $groups[ $i ]->name ) {
$selected = ' class="current"';
}
// Skip if group has no fields.
if ( empty( $groups[ $i ]->fields ) ) {
continue;
}
// Build the profile field group link.
$link = trailingslashit( bp_displayed_user_domain() . bp_get_profile_slug() . '/edit/group/' . $groups[ $i ]->id );
// Add tab to end of tabs array.
$tabs[] = sprintf(
'<li %1$s><a href="%2$s">%3$s</a></li>',
$selected,
esc_url( $link ),
esc_html( apply_filters( 'bp_get_the_profile_group_name', $groups[ $i ]->name ) )
);
}
/**
* Filters the tabs to display for profile field groups.
*
* @since BuddyPress 1.5.0
*
* @param array $tabs Array of tabs to display.
* @param array $groups Array of profile groups.
* @param string $group_name Name of the current group displayed.
*/
$tabs = apply_filters( 'xprofile_filter_profile_group_tabs', $tabs, $groups, $group_name );
return join( '', $tabs );
}
Changelog
| Version | Description |
|---|---|
| BuddyPress 2.3.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.