Plugin

Active

LH User Provisioning is the canonical, network-wide entry point for creating and cleaning up WordPress users on the LocalHero platform. Rather than calling wp_insert_user() directly, other LH plugins call lh_user_provisioning_ensure_user(), guaranteeing every account — however it was created — meets the same conventions: login matches email, nicename matches numeric user ID, BuddyPress profile scaffolding, and a provenance record of where the account came from.

Why it exists

Before this plugin, user-creation logic — and the login/nicename conventions LocalHero relies on — was duplicated across several plugins (membership registration, BuddyPress group invites, etc.), each with its own drift-prone copy. Centralising it here means a single, guarded, idempotent implementation, and means the convention is enforced network-wide in real time (via user_register/profile_update hooks) for every account, not just ones created through this plugin’s own API — a WooCommerce checkout, a manually-added wp-admin user, or a CSV import all get the same guarantee.

Key features

  • lh_user_provisioning_ensure_user( $email, $args ) — idempotent: creates the user if they don’t exist, cleans them up if they do, records provenance on first creation, and returns the WP_User/WP_Error
  • lh_user_provisioning_resolve_user( $email ) — alias-aware “does this user exist” lookup with no side effects
  • lh_user_provisioning_cleanup( $user ) — idempotently brings an existing user up to lhero standard
  • Alias-aware email resolution: checks wp_users first, then falls back to lh-user-identity‘s lh_user_identity_get_user_by_email_fallback filter (a documented no-op when that plugin isn’t active), so provisioning by a registered alias email reuses the existing account instead of creating a duplicate
  • Real-time, network-wide convention enforcement via user_register/profile_update hooks (priority 20), independent of this plugin’s own API
  • Provenance tracking (source plugin, action, optional reference ID, site ID) as usermeta, surfaced as a “Provisioned Via” column on the Network Admin → Users screen
  • Hourly integrity-check cron as a backstop for accounts predating the real-time hooks

Install / setup

Network-activate only — activating on an individual site is blocked with an explanatory message, since login/nicename conventions and the provenance column are network-wide concerns. No configuration required.

Who depends on this

lh-buddypress-add-user delegates its actual user creation/cleanup to lh_user_provisioning_ensure_user() rather than duplicating that logic, and lh-user-identity documents this plugin as the preferred route for any plugin that creates or provisions users. This makes LH User Provisioning load-bearing infrastructure that other, independently migration-relevant plugins hard-depend on.

Contents