bp_xprofile_get_groups( array $args = array() )

Fetch a set of field groups, populated with fields and field data.

Description

Procedural wrapper for BP_XProfile_Group::get() method.

Parameters

$args

(array) (Optional) See BP_XProfile_Group::get() for description of arguments.

Default value: array()

Return

(array) $groups

Source

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

function bp_xprofile_get_groups( $args = array() ) {

    /**
     * For repeaters, automatically set the parameter value
     * to determine if we should display only the template fields
     * or only the clone fields
     */

    if ( !isset( $args[ 'repeater_show_main_fields_only' ] ) ) {
        $repeater_show_main_fields_only = true;

        //If on a user profile
        if ( 'profile' == bp_current_component() ) {
            $repeater_show_main_fields_only = false;
        }

        $args[ 'repeater_show_main_fields_only' ] = apply_filters( 'bp_xprofile_get_groups_repeater_show_main_fields_only', $repeater_show_main_fields_only );
    }

	$groups = BP_XProfile_Group::get( $args );

	/**
	 * Filters a set of field groups, populated with fields and field data.
	 *
	 * @since BuddyPress 2.1.0
	 *
	 * @param array $groups Array of field groups and field data.
	 * @param array $args   Array of arguments used to query for groups.
	 */
	return apply_filters( 'bp_xprofile_get_groups', $groups, $args );
}

Changelog

Changelog
Version Description
BuddyPress 2.1.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.