As part of BuddyPress 5.0, we’ve included a new core API for managing invitations. This API stores data in a new table,
bp_invitations, and introduces new classes to handle working with invitations stored in the new table. The API clears the way for the development of useful features like site invitations (hopefully coming in 5.1) but starts by handling group invitations and membership requests.
For most users and developers, the changes will be subtle. Existing group invitations will be migrated to the invitations table, and the current behaviors have been maintained. Managing invitations and requests will still be accomplished using familiar functions like
groups_accept_membership_request(). Queries made using
BP_Group_Member_Query will continue to work as expected.
However, if you are directly querying the
bp_groups_members table to find invitations and membership requests, these queries will no longer work, since the pending memberships will be stored in the new
bp_invitations table. Happily, we’ve introduced several new functions, like
groups_get_requests(), that make finding invitations easier and more reliable.
The signatures of several functions have changed from accepting one or two parameters to accepting an array of parameters to support the new flexibility of the underlying API. The following functions now accept an array of parameters and will issue a deprecation notice if standard parameters are passed into them:
Three membership request management functions have also changed from accepting a
membership_id as the first parameter to relying on the
group_id parameters to find the correct request to change:
Other improvements include the following:
BP_Invitationobjects are cached
- Queries made via the
BP_Invitationclass are cached
- Extension is straightforward; see
BP_Groups_Invitation_Managerfor an example
- Many scattered direct queries have been replaced by calls to the API
- Messages included in invitations and requests are now included in the notice email
If you have any questions or comments, please let us know.