Digital Sovereignty for everyone

Organisation invitations

An organisation invitation records that someone has been invited to join a site, and optionally which team (BuddyPress group) they will play in. It replaces BuddyPress’s site invitation, and lets someone sign up for a team without being in it until their membership is approved.

How it is stored

  • Rows in BuddyPress’s invitations table with class LH_Membership_Organisation_Team_Invitation_Manager: item_id is the site, secondary_item_id the team, or 0 for none, and inviter_id who invited them (themselves when their own registration did).
  • One open row per person and site. A team picked later is written onto the existing open row rather than added as a second one.
  • Two states only: open (accepted 0) until the person accepts or declines the terms, then accepted (1). Open rows are the people still to follow up.
  • Rows are kept as the invitation history. Only deleting the account deletes them.

Lifecycle

  • Registration creates an open invitation with no team. A group invitation BuddyPress creates for the registrant during registration (a team picker, say) becomes that invitation’s team and the group invitation is removed. Someone already a member of the site keeps the ordinary group invitation.
  • Consent step: group invitations the applicant ticks are held the same way, keeping the original inviter. Members accept them straight away.
  • Accepting or declining the terms marks the person’s open invitations accepted.
  • Approval joins the person to the team on each invitation approval has not processed before, before the welcome email is sent. A team they are banned from, or one that no longer exists, is skipped and logged. The highest invitation ID processed is kept per person and site in the user option lh_membership-org_invites_processed, so approving someone again does not put them back in teams they have left.
  • Rejection or removal from the site closes the person’s open invitations (marks them accepted).

All of it runs in network-activated LH Membership, so it behaves the same when approval or rejection runs for another site over MCP with site_id.

Hooks

  • lh_membership_org_team_invite_created ( int $invite_id, int $user_id, int $group_id, int $inviter_id ): an invitation is created, or a team is added to an open one. $group_id is 0 for no team.
  • lh_membership_org_team_invite_accepted ( BP_Invitation $invite, bool $joined ): for each invitation on approval; $joined is whether they are now in its team.
  • lh_membership_org_team_invite_closed ( BP_Invitation $invite, string $reason ): an open invitation closed by rejected or removed_from_site.
  • lh_membership_make_user_member_in_backend_before_email ( int $user_id ): fires during approval after roles are set and before the welcome email; teams are joined here.

Code

includes/lh-membership-organisation-team-invitations-class.php (lifecycle) and includes/lh-membership-organisation-team-invitation-manager.php (the BuddyPress invitation manager). LH_Membership_user_invitations_class reads and creates site invitations through it. (Since 2.101.0; replaces BuddyPress site invitations since 2.103.0; kept as history since 2.104.0.)

If you like this plugin please consider making a donation to further development

Install LHero.org

lhero.org

Open it straight from your home screen, full screen and quicker to load.

  1. Tap the Share button . If you cannot see it, tap ••• first.
  2. Scroll down and tap Add to Home Screen.
  3. Tap Add.
  1. Tap the browser menu â‹®.
  2. Tap Install app or Add to Home screen.
  1. In the menu bar, choose File, then Add to Dock.

Use your browser's menu to install this site or add it to your home screen.