bp_get_profile_group_tabs()

Return the XProfile group tabs.

Description

Return

(string)

Source

File: bp-xprofile/bp-xprofile-template.php

1137
1138
1139
1140
1141
1142
1143
1144
1145
1146
1147
1148
1149
1150
1151
1152
1153
1154
1155
1156
1157
1158
1159
1160
1161
1162
1163
1164
1165
1166
1167
1168
1169
1170
1171
1172
1173
1174
1175
1176
1177
1178
1179
1180
1181
1182
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

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.