Since 3.29.0 delete-unclaimed-user (LH_Profile_Delete_Unclaimed_User_Ability, includes/lh-profile-delete-unclaimed-user-ability-class.php) deletes, network-wide, an account that something created automatically and nobody ever claimed: the account email ingestion made for a spam sender, or a typo address copied on a team email. lh-email’s mark-as-spam is meant to call it after its grace period (lh-tasks #151719); it can also be called on its own. It requires install_plugins, filterable with lh_profile_delete_unclaimed_user_return_capability.
Every check must pass, or the call returns step: refused with each check’s result and no token. The checks are:
LH_Profile_Sync_Display_Name_Ability::return_claimed_roles(), so the bbPress roles it ignores are ignored here too.lh_provisioning_source must be one of lh-messaging, lh-email or lh_crm (filter lh_profile_return_unclaimed_delete_sources). An account with no provenance, or one from check-ins or group invites, is refused, since those mean a real person turned up or was added by someone who knows them. Accounts made by email ingestion carry lh-messaging.last_activity, which LH User Provisioning seeds; no WooCommerce orders (legacy _customer_user or HPOS wc_orders by customer or billing email) on any of the user’s sites; no posts of any type except revisions and auto-drafts on any of their sites, since wpmu_delete_user() would delete them; no active LH Phone Numbers links.lh_messages row they sent or authored without spam_flagged_at. Mail sent to them does not block.The whole list is filterable with lh_profile_return_unclaimed_delete_checks: an array of check name => callable taking the WP_User and returning '' to pass or a reason to refuse.
The confirm token is a site transient keyed by the token’s hash, valid 10 minutes, bound to the actor, the user and the preview’s findings (email, provenance, every check result and the removal counts); the apply re-runs everything and refuses if any of it changed. On apply: LH_Messaging_Store::delete_sender_messages() deletes the messages they sent with their recipient rows and unlinks rows for mail sent to them; unlink_user() clears anything they authored; their BuddyPress invitation rows are deleted; then wpmu_delete_user() removes the account, which also fires LH Phone Numbers’ and BuddyPress’s own cleanup. The deletion is recorded in LH Audit Trail as account.unclaimed_user_deleted (not member-visible, since the account is gone; kept forever), with the email, display name, provenance, removals, the reason as its note and the lh-tasks task_id when given. The lh_profile_unclaimed_user_deleted action fires with the user ID, that record, the reason and the task ID.
LH_Messaging_Store::set_spam_flag()) before the account can be deleted. Until mark-as-spam exists there is no ability that flags them.buddypress()->members->table_name_invitations; BP_Invitation::get_table_name() is not public (fixed in 3.29.1).