Profile Group

Schema

The schema defines all the fields that exist for a profile group object.

id

integer
A unique numeric ID for the group of profile fields.
Read only
Context: viewedit
name

string
The name of the group of profile fields.
Context: view, edit
description

object
The raw and rendered descriptions of the group of profile fields.
Context: viewedit
group_order

integer
The order of the group of profile fields.
Context: viewedit
can_delete

boolean
Whether the group of profile fields can be deleted or not.
Context: viewedit
fields

array
The list of profile fields object attached to the group of profile fields.
Context: viewedit

Top ↑

List groups of profile fields

Top ↑

Arguments

NameTypeDescription
contextstringScope under which the request is made; determines fields present in response.
Default: view
One of: view, edit
pageintegerCurrent page of the collection of groups of profile fields.
Default: 1
per_pageintegerMaximum number of groups of profile fields to be returned in result set.
Default: 10
searchstringLimit results to those matching a string.
profile_group_idintegerID of the group of profile fields that has fields.
hide_empty_groupsbooleanWhether to hide profile groups that do not have any profile fields or not.
Default: false
user_idintegerNeeded if you want to load a specific user’s data.
Default: the logged in user ID.
member_typearrayLimit fields by those restricted to a given member type, or array of member types. If $user_id is provided, the value of $member_type will be overridden by the member types of the provided user. The special value of ‘any’ will return only those fields that are unrestricted by member type – i.e., those applicable to any type.
Default: []
hide_empty_fieldsbooleanWhether to hide profile fields of profile groups that do not have any content or not.
Default: false
fetch_fieldsbooleanWhether to fetch the profile fields for each profile group.
Default: false
fetch_field_databooleanWhether to fetch data for each profile field. Requires a $user_id.
Default: false
fetch_visibility_levelbooleanWhether to fetch the visibility level for each profile field.
Default: false
signup_fields_onlybooleanWhether to only return signup fields.
Default: false
exclude_groupsarrayEnsure result set excludes specific groups of profile fields.
Default: []
exclude_fieldsarrayEnsure result set excludes specific profile fields.
Default: []
update_meta_cachebooleanWhether to pre-fetch xprofile metadata for all retrieved groups, fields, and data.
Default: true

Top ↑

Definition

GET /buddypress/v1/xprofile/groups

Top ↑

Example of use

Alert: To use the bp.apiRequest function, you need to enqueue the bp-api-request JavaScript or use it as a dependency of your script. Refer to this page to know more about loading JavaScript files in WordPress.
bp.apiRequest( {
  path: 'buddypress/v1/xprofile/groups',
  type: 'GET',
  data: {
    context: 'view',
    fetch_fields: true,
    signup_fields_only: true
  }
} ).done( function( data ) {
  return data;
} ).fail( function( error ) {
  return error;
} );

Top ↑

Create a group of profile fields

Top ↑

Arguments

NameTypeDescription
namestringThe name of the group of profile fields.
Required
descriptionstringThe description of the group of profile fields.
can_deletebooleanWhether the group of profile fields can be deleted or not.
Default: true

Top ↑

Definition

POST /buddypress/v1/xprofile/groups

Top ↑

Example of use

Alert: To use the bp.apiRequest function, you need to enqueue the bp-api-request JavaScript or use it as a dependency of your script. Refer to this page to know more about loading JavaScript files in WordPress.

bp.apiRequest( {
  path: 'buddypress/v1/xprofile/groups',
  type: 'POST',
  data: {
    context: 'edit',
    name: 'Skills',
    description: 'Information about your skills'
  }
} ).done( function( data ) {
  return data;
} ).fail( function( error ) {
  return error;
} );

Top ↑

Retrieve a specific group of profile fields

Top ↑

Arguments

NameTypeDescription
idintegerA unique numeric ID for the group of profile fields.
Required

Top ↑

Definition

GET /buddypress/v1/xprofile/groups/<id>

Top ↑

Example of use

Alert: To use the bp.apiRequest function, you need to enqueue the bp-api-request JavaScript or use it as a dependency of your script. Refer to this page to know more about loading JavaScript files in WordPress.

bp.apiRequest( {
  path: 'buddypress/v1/xprofile/groups/3',
  type: 'GET',
  data: {
    context: 'view'
  }
} ).done( function( data ) {
  return data;
} ).fail( function( error ) {
  return error;
} );

Top ↑

Update a specific group of profile fields

Top ↑

Arguments

NameTypeDescription
idintegerA unique numeric ID for the group of profile fields.
Required
namestringThe name of the group of profile fields.
descriptionstringThe description of the group of profile fields.
group_orderintegerThe order of the group of profile fields.
can_deletebooleanWhether the group of profile fields can be deleted or not.

Top ↑

Definition

PUT /buddypress/v1/xprofile/groups/<id>

Top ↑

Example of use

Alert: To use the bp.apiRequest function, you need to enqueue the bp-api-request JavaScript or use it as a dependency of your script. Refer to this page to know more about loading JavaScript files in WordPress.

bp.apiRequest( {
  path: 'buddypress/v1/xprofile/groups/3',
  type: 'PUT',
  data: {
    context: 'edit',
    group_order: 1
  }
} ).done( function( data ) {
  return data;
} ).fail( function( error ) {
  return error;
} );

Top ↑

Delete a group of profile fields

Top ↑

Arguments

NameTypeDescription
idintegerA unique numeric ID for the group of profile fields.
Required

Top ↑

Definition

DELETE /buddypress/v1/xprofile/groups/<id>

Top ↑

Example of use

Alert: To use the bp.apiRequest function, you need to enqueue the bp-api-request JavaScript or use it as a dependency of your script. Refer to this page to know more about loading JavaScript files in WordPress.

bp.apiRequest( {
  path: 'buddypress/v1/xprofile/groups/3',
  type: 'DELETE',
  data: {
    context: 'edit'
  }
} ).done( function( data ) {
  return data;
} ).fail( function( error ) {
  return error;
} );