Group Invites

Schema

The schema defines all the fields that exist for a group invite 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 is invited to join the Group.
Context: viewedit
invite_sent

boolean
Whether the invite has been sent to the invitee.
Context: viewedit
inviter_id

integer
The ID of the user who made the invite.
Context: viewedit
group_id

integer
The ID of the group to which the user has been invited.
Context: viewedit
date_modified

string or null
The date the object was created or last updated, in the site’s timezone.
Read only
Context: viewedit
date_modified_gmt

string or null
The date the object was created or last updated, as GMT.
Read only
Context: viewedit
type

string
Invitation or request.
Context: viewedit
Default: invite
One of: inviterequest
message

object
The raw and rendered versions for the content of the message.
Context: viewedit

Top ↑

List the Group Invites

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_idintegerID of the group to limit results to.
Default: 0
user_idintegerReturn only invitations extended to this user.
Default: 0
inviter_idintegerReturn only invitations extended by this user.
Default: 0
invite_sentstringLimit result set to invites that have been sent, not sent, or include all.
Default: sent
One of : draft, sent, all

Top ↑

Definition

GET /buddypress/v1/groups/invites

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

Top ↑

Invite a user to join a Group

Top ↑

Arguments

NameTypeDescription
user_idintegerThe ID of the user who is invited to join the Group.
Required
inviter_idintegerThe ID of the user who made the invite.
Default: the current logged in user ID.
group_idintegerThe ID of the group to which the user has been invited.
Required
messagestringThe optional message to send to the invited user.
send_invitebooleanWhether the invite should be sent to the invitee.
Default: true

Top ↑

Definition

POST /buddypress/v1/groups/invites

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/invites',
  type: 'POST',
  data: {
    context: 'edit',
    user_id: 13,
    group_id: 7,
    message: 'Join the BuddyPress Contributors Group'
  }
} ).done( function( data ) {
  return data;
} ).fail( function( error ) {
  return error;
} );

Top ↑

Retrieve a specific Group Invite

Top ↑

Arguments

NameTypeDescription
invite_idintegerA unique numeric ID for the group invitation.
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/invites/<invite_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/invites/5',
  type: 'GET',
  data: {
    context: 'view'
  }
} ).done( function( data ) {
  return data;
} ).fail( function( error ) {
  return error;
} );

Top ↑

Accept a specific Group Invite

Top ↑

Arguments

NameTypeDescription
invite_idintegerA unique numeric ID for the group invitation.
Required

Top ↑

Definition

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

Top ↑

Reject or remove a specific Group Invite

Note: If the invited user is the logged in user then the Group Invite will be rejected. Otherwise the uninvite action will be used.

Top ↑

Arguments

NameTypeDescription
invite_idintegerA unique numeric ID for the group invitation.
Required

Top ↑

Definition

DELETE /buddypress/v1/groups/invites/<invite_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/components',
  type: 'GET',
  data: {
    context: 'view'
  }
} ).done( function( data ) {
  return data;
} ).fail( function( error ) {
  return error;
} );