Group Membership Requests

Schema

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

id

integer
A unique numeric ID for the BP Invitation object.
Read only
Context: viewedit
user_id

integer
The ID of the user who requested a Group membership.
Context: viewedit
group_id

integer
The ID of the group the user requested a membership for.
Context: viewedit
date_modified

string,
date-time
The date the object was created or last updated, in the site’s timezone. 
Context: viewedit
type

string
A request for membership to a private group. 
Context: viewedit
Default: request
One of: inviterequest
message
string
The raw and rendered versions for the content of the message.
Context: viewedit

Top ↑

List the Group Membership Requests

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.
Default: 1
per_pageintegerMaximum number of items to be returned in result set.
Default: 10
group_idintegerThe ID of the group the user requested a membership for.
user_idintegerReturn only Membership requests made by a specific user.

Top ↑

Definition

GET /buddypress/v1/groups/membership-requests

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

Top ↑

Request a Group Membership

Top ↑

Arguments

NameTypeDescription
user_idintegerThe ID of the user who requested a Group membership.
Default: the logged in user ID
group_idintegerThe ID of the group the user requested a membership for.
Required
messagestringThe optional message the user requesting membership to private group sends to the group administrator.

Top ↑

Definition

POST /buddypress/v1/groups/membership-requests

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/groups/membership-requests',
  type: 'POST',
  data: {
    context: 'edit',
    group_id: 30
  }
} ).done( function( data ) {
  return data;
} ).fail( function( error ) {
  return error;
} );

Top ↑

Retrieve a specific Group Membership Request

Top ↑

Arguments

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

Top ↑

Definition

GET /buddypress/v1/groups/membership-requests/<request_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/groups/membership-requests/12',
  type: 'GET',
  data: {
    context: 'view'
  }
} ).done( function( data ) {
  return data;
} ).fail( function( error ) {
  return error;
} );

Top ↑

Accept a Group Membership Request

Top ↑

Arguments

NameTypeDescription
request_idintegerA unique numeric ID for the group membership request.
Required

Top ↑

Definition

PUT /buddypress/v1/groups/membership-requests/<request_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/groups/membership-requests/12',
  type: 'PUT',
  data: {
    context: 'edit'
  }
} ).done( function( data ) {
  return data;
} ).fail( function( error ) {
  return error;
} );

Top ↑

Reject or cancel a Group Membership Request

Note: If the logged in user is the one who requested a Group membership, using this endpoint will cancel it. Otherwise it will reject it.

Top ↑

Arguments

NameTypeDescription
request_idintegerA unique numeric ID for the group membership request.
Required

Top ↑

Definition

DELETE /buddypress/v1/groups/membership-requests/<request_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/groups/membership-requests/12',
  type: 'DELETE',
  data: {
    context: 'edit'
  }
} ).done( function( data ) {
  return data;
} ).fail( function( error ) {
  return error;
} );