Groups

Schema Schema

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

id

integer
A unique numeric ID for the Group.
Read only
Context: viewedit
creator_id

integer
The ID of the user who created the Group.
Context: viewedit
name

string
The name of the group.
Context: viewedit
slug

string
The URL-friendly slug for the group.
Context: viewedit
link

string,
uri
The permalink to the Group on the site.
Read only
Context: viewedit
description

object
The raw and rendered descriptions of the Group.
Context: viewedit
status

string
The visibility status of the Group.
Context: viewedit
One of: public, private, hidden
enable_forum

boolean
Whether the group has a forum or not.
Context: viewedit
parent_id

integer
ID of the parent Group.
Context: viewedit
date_created

string,
date-time
The date the Group was created, in the site’s timezone.
Read only
Context: viewedit
types

array
The Group Types. See this documentation page for more information about Groupe Types.
Read only
Context: viewedit
admins

array
List of WP_User objects for Group administrators.
Read only
Context: edit
mods

array
List of WP_User objects for moderators.
Read only
Context: edit
total_member_count
integer
Count of all Group members.
Read only
Context: edit
last_activity

string,
date-time
The date the Group was last active, in the site’s timezone.
Read only
Context: edit
avatar_urls (1)

object
Avatar URLs for the group (Full & Thumb sizes).
Read only
Context: viewedit

(1) Only if Group Avatar uploads are enabled on the community site.

Top ↑

List User Groups List User Groups

Arguments 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.
Default: 1
per_pageintegerMaximum number of Groups to be returned in result set.
Default: 10
searchstringLimit results to Group names or descriptions matching a string.
typestringShorthand for certain orderby/order combinations.
Default: active
One of: active, newest, alphabetical, random, popular, most-forum-topics, most-forum-posts
orderstringOrder sort attribute ascending or descending.
Default: desc
One of : asc, desc
orderbystringOrder Groups by which attribute.
Default: date_created
One of : date_created, last_activity, total_member_count, name, random
statusarrayGroup statuses to limit results to.
Default: []
One or more of : public, private, hidden
user_idintegerPass a user_id to limit to only Groups that this user is a member of.
Default: 0
parent_idarrayGet Groups that are children of the specified Group(s) IDs.
Default: []
metaarrayGet Groups based on their meta data information.
Default: []
includearrayEnsure result set includes Groups with specific IDs.
Default: []
excludearrayEnsure result set excludes Groups with specific IDs.
Default: []
group_typestringLimit results set a to certain Group type. See this documentation page for more information about Group Types.
One of: The active Group types on the site.
enable_forumbooleanWhether the group has a forum enabled.
Default: false
show_hiddenbooleanWhether results should include hidden groups.
Default: false

Top ↑

Definition Definition

GET /buddypress/v1/groups

Top ↑

Example of use 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/groups',
  type: 'GET',
  data: {
    context: 'view'
  }
} ).done( function( data ) {
  return data;
} ).fail( function( error ) {
  return error;
} );

Top ↑

Create a User Group Create a User Group

Top ↑

Arguments Arguments

NameTypeDescription
creator_idintegerThe ID of the user who created the Group.
Default: the logged in user ID
namestringThe name of the Group.
Required
slugstringThe URL-friendly slug for the Group.
descriptionstringThe description of the Group.
Required
statusstringThe status of the Group.
Default: public
One of : public, private, hidden
enable_forumbooleanWhether the Group has a forum or not.
parent_idintegerID of the parent Group.
typesarrayThe Group Types. See this documentation page for more information about Group Types.

Top ↑

Definition Definition

POST /buddypress/v1/groups

Top ↑

Example of use 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/groups',
  type: 'POST',
  data: {
    context: 'edit',
    creator_id: 4,
    name: 'BuddyPress Group',          // Required.
    description: 'My beautiful group', // Required.
  }
} ).done( function( data ) {
  return data;
} ).fail( function( error ) {
  return error;
} );

Top ↑

Retrieve a specific User Group Retrieve a specific User Group

Top ↑

Arguments Arguments

NameTypeDescription
idintegerA unique numeric ID for the Group.
contextstringScope under which the request is made; determines fields present in response.
Default: view
One of : view, edit

Top ↑

Definition Definition

GET /buddypress/v1/groups/<group_id>

Top ↑

Example of use 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/groups/51',
  type: 'GET',
  data: {
    context: 'view'
  }
} ).done( function( data ) {
  return data;
} ).fail( function( error ) {
  return error;
} );

Top ↑

Update a User Group Update a User Group

Top ↑

Arguments Arguments

NameTypeDescription
idintegerA unique numeric ID for the Group.
creator_idintegerThe ID of the user who created the Group.
namestringThe name of the Group.
descriptionstringThe description of the Group.
statusstringThe status of the Group.
Default: public
One of : public, private, hidden
enable_forumbooleanWhether the Group has a forum or not.
parent_idintegerID of the parent Group.
typesarrayThe Group Types. See this documentation page for more information about Group Types.

Top ↑

Definition Definition

PUT /buddypress/v1/groups/<group_id>

Top ↑

Example of use 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/groups/51',
  type: 'PUT',
  data: {
    context: 'edit',
    name: 'My awesome Group'
  }
} ).done( function( data ) {
  return data;
} ).fail( function( error ) {
  return error;
} );

Top ↑

Delete a User Group Delete a User Group

Top ↑

Arguments Arguments

NameTypeDescription
idintegerA unique numeric ID for the Group.

Top ↑

Definition Definition

DELETE /buddypress/v1/groups/<group_id>

Top ↑

Example of use 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/groups/51',
  type: 'DELETE',
  data: {
    context: 'edit'
  }
} ).done( function( data ) {
  return data;
} ).fail( function( error ) {
  return error;
} );