Digital Sovereignty for everyone

Invitation meta

BuddyPress has no meta for invitations, so LH Membership adds it: per-invitation data such as when a reminder was sent, kept with the invitation and deleted with it.

Storage

  • A table beside the invitations table BuddyPress actually uses, named from it: BP_Invitation_Manager::get_table_name() plus _invitemeta, so lhero_bp_invitations_invitemeta on LocalHero. It is in BuddyPress’s meta-table shape: id (primary key), invite_id (indexed), meta_key (indexed) and meta_value.
  • The name is deliberately not built from bp_core_get_table_prefix(). On LocalHero, LH BuddyPress Multi Network makes that prefix each site’s own, while the invitations table is kept network-wide, so the prefix would give each site its own meta table. Before 2.120.1 it did: a site’s own requests (its reminder runs among them) wrote to a per-site table, while requests reaching the site with site_id read the network one.
  • Read and written with WordPress’s metadata API under the meta type invite ($wpdb->invitemeta), wrapped in BuddyPress’s bp_filter_metaid_column_name exactly as BuddyPress’s groupmeta functions are.
  • Object-cached in the invite_meta group, registered as a global cache group, so meta reads the same from any site, including through the main connector with site_id.
  • When BuddyPress deletes invitations (today only when an account is deleted), their meta is deleted with them.

Functions

Static methods on LH_Membership_organisation_team_invitations_class, with the same arguments as WordPress’s own meta functions:

  • add_invite_meta( $invite_id, $meta_key, $meta_value, $unique = false )
  • get_invite_meta( $invite_id, $meta_key = '', $single = true ): an empty key returns all of the invitation’s meta.
  • update_invite_meta( $invite_id, $meta_key, $meta_value, $prev_value = '' )
  • delete_invite_meta( $invite_id, $meta_key = '', $meta_value = '' ): an empty key deletes all of the invitation’s meta.

They are deliberately not named bp_invitations_*_invitemeta(), so they cannot clash with BuddyBoss’s functions of that name or with any BuddyPress adds later.

Installation

The table is created with dbDelta if it is missing, once per network, keyed on the class’s schema_version() (recorded in the network option lh_membership-invitemeta_schema_version), never on the plugin version. A table that already exists with the same schema is used as it is: on LocalHero it was created earlier by BuddyBoss. If BuddyBoss is active, its own invitation meta functions are left alone; they share the table, so there is no conflict.

Filters

  • lh_membership_return_invite_meta_table_name ( string $table ): the table.
  • lh_membership_return_invite_meta_type ( string $type ): the meta type. WordPress derives the $wpdb property, the invite_id column and the cache group from it, so change it only together with the table.

The code is in includes/lh-membership-organisation-team-invitations-class.php. (Since 2.113.0; table named from BuddyPress’s invitations table since 2.120.1.)

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.