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_invite_user()
or 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_invites()
and 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:
groups_send_invites()
groups_send_membership_request()
Three membership request management functions have also changed from accepting a membership_id
as the first parameter to relying on the user_id
and group_id
parameters to find the correct request to change:
groups_accept_membership_request()
groups_reject_membership_request()
groups_delete_membership_request()
Other improvements include the following:
BP_Invitation
objects are cached- Queries made via the
BP_Invitation
class are cached - Extension is straightforward; see
BP_Groups_Invitation_Manager
for 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.