A site can require approval before its members join a team. When it does, the team’s Join button reads Request to join, and pressing it records a request instead of joining. Once a request is open the button reads Request pending. Nothing changes on a site that does not ask for this.
Turning it on
A site plugin returns true from lh_membership_team_join_requires_review( $requires, $user_id, $group_id, $context ) for the joins it wants reviewed. The filter defaults to false, and people who can approve requests (add_users on the site) are never held. $context is join (the Join button).
Deciding
- Approvers are users with
add_userson the site, as for membership applications. They get one rolling BuddyPress notification per site (“Jane Smith asked to join Team”). - Users > Team Requests lists open requests with Approve and Decline. It appears when the site has a review rule or open requests.
- Approving adds the member to the team. Declining closes the request; the member can ask again. Either way the member gets a BuddyPress notification.
- If the member joins the team another way, for example their captain adds them, the open request is closed.
- The
list-team-requests,approve-team-requestsanddecline-team-requestsabilities do the same over MCP, per site (site_id).
Storage
Requests are rows of the organisation invitation class (LH_Membership_Organisation_Team_Invitation_Manager) with type request: item_id the site, secondary_item_id the team, inviter_id the member. Open until decided, then marked accepted and kept as history. Deleting the account deletes them.
Hooks
lh_membership_team_join_requires_review(filter): whether a join needs review.lh_membership_team_request_notes(filter): plain-text context shown to approvers for a request, such as the member’s other teams.lh_membership_team_request_created,_approved,_declinedand_closed(actions).
Not yet covered
Accepting a captain’s group invite, and requesting membership of a private group, still join or go to the group admins as before.

