@prefix sioc: <http://rdfs.org/sioc/ns#> .
@prefix dc: <http://purl.org/dc/elements/1.1/> .
@prefix dcterms: <http://purl.org/dc/terms/> .
@prefix xsd: <http://www.w3.org/2001/XMLSchema#> .
@prefix content: <http://purl.org/rss/1.0/modules/content/> .
@prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> .
@prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> .

<https://lhero.org/portfolio/lh-profile-page/>
  a sioc:Post ;
  dc:title "Deleting unclaimed accounts" ;
  dcterms:identifier 155675 ;
  dc:modified "2026-11-28T03:55:42Z"^^xsd:dateTime ;
  dc:created "2026-11-28T03:55:42Z"^^xsd:dateTime ;
  sioc:link <https://lhero.org/portfolio/lh-profile-page/deleting-unclaimed-accounts/> ;
  sioc:has_creator <https://lhero.org/author/1/#account> ;
  sioc:has_container <https://lhero.org/#posts> ;
  content:encoded "<ul class=\"lh_portfolio-meta\"><li><strong>Part of:</strong> <a href=\"https://lhero.org/portfolio/lh-profile-page/\">LH Profile Page</a></li></ul><p class=\"wp-block-paragraph\">Since 3.29.0 <code>delete-unclaimed-user</code> (<code>LH_Profile_Delete_Unclaimed_User_Ability</code>, <code>includes/lh-profile-delete-unclaimed-user-ability-class.php</code>) 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&#8217;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 <code>install_plugins</code>, filterable with <code>lh_profile_delete_unclaimed_user_return_capability</code>.</p><h2 class=\"wp-block-heading\">Checks</h2><p class=\"wp-block-paragraph\">Every check must pass, or the call returns <code>step: refused</code> with each check&#8217;s result and no token. The checks are:</p><ul class=\"wp-block-list\"><li><strong>Not yourself, not a super admin.</strong></li><li><strong>Unclaimed only.</strong> No role other than unclaimed on any site, using <code>LH_Profile_Sync_Display_Name_Ability::return_claimed_roles()</code>, so the bbPress roles it ignores are ignored here too.</li><li><strong>Provenance.</strong> LH User Provisioning&#8217;s <code>lh_provisioning_source</code> must be one of <code>lh-messaging</code>, <code>lh-email</code> or <code>lh_crm</code> (filter <code>lh_profile_return_unclaimed_delete_sources</code>). 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 <code>lh-messaging</code>.</li><li><strong>No relationships.</strong> No BuddyPress group membership rows, membership requests or invitations sent to others; no friendships; no activity other than <code>last_activity</code>, which LH User Provisioning seeds; no WooCommerce orders (legacy <code>_customer_user</code> or HPOS <code>wc_orders</code> by customer or billing email) on any of the user&#8217;s sites; no posts of any type except revisions and auto-drafts on any of their sites, since <code>wpmu_delete_user()</code> would delete them; no active LH Phone Numbers links.</li><li><strong>Messages.</strong> No <code>lh_messages</code> row they sent or authored without <code>spam_flagged_at</code>. Mail sent <em>to</em> them does not block.</li></ul><p class=\"wp-block-paragraph\">The whole list is filterable with <code>lh_profile_return_unclaimed_delete_checks</code>: an array of check name =&gt; callable taking the <code>WP_User</code> and returning <code>''</code> to pass or a reason to refuse.</p><h2 class=\"wp-block-heading\">Preview and apply</h2><p class=\"wp-block-paragraph\">The confirm token is a site transient keyed by the token&#8217;s hash, valid 10 minutes, bound to the actor, the user and the preview&#8217;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: <code>LH_Messaging_Store::delete_sender_messages()</code> deletes the messages they sent with their recipient rows and unlinks rows for mail sent to them; <code>unlink_user()</code> clears anything they authored; their BuddyPress invitation rows are deleted; then <code>wpmu_delete_user()</code> removes the account, which also fires LH Phone Numbers&#8217; and BuddyPress&#8217;s own cleanup. The deletion is recorded in LH Audit Trail as <code>account.unclaimed_user_deleted</code> (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 <code>task_id</code> when given. The <code>lh_profile_unclaimed_user_deleted</code> action fires with the user ID, that record, the reason and the task ID.</p><h2 class=\"wp-block-heading\">Gotchas</h2><ul class=\"wp-block-list\"><li>Deleting a user flushes the object cache on this network, which drops every outstanding confirm token. Preview and apply one account at a time; several previews followed by several applies leave only the first apply working.</li><li>A spam sender&#8217;s messages must be flagged as spam (<code>LH_Messaging_Store::set_spam_flag()</code>) before the account can be deleted. Until mark-as-spam exists there is no ability that flags them.</li><li>BuddyPress&#8217;s invitations table is read from <code>buddypress()-&gt;members-&gt;table_name_invitations</code>; <code>BP_Invitation::get_table_name()</code> is not public (fixed in 3.29.1).</li></ul>"^^rdf:XMLLiteral ;
  sioc:content "Part of: LH Profile PageSince 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&#8217;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.ChecksEvery check must pass, or the call returns step: refused with each check&#8217;s result and no token. The checks are:Not yourself, not a super admin.Unclaimed only. No role other than unclaimed on any site, using LH_Profile_Sync_Display_Name_Ability::return_claimed_roles(), so the bbPress roles it ignores are ignored here too.Provenance. LH User Provisioning&#8217;s 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.No relationships. No BuddyPress group membership rows, membership requests or invitations sent to others; no friendships; no activity other than 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&#8217;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.Messages. No 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 =&gt; callable taking the WP_User and returning '' to pass or a reason to refuse.Preview and applyThe confirm token is a site transient keyed by the token&#8217;s hash, valid 10 minutes, bound to the actor, the user and the preview&#8217;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&#8217; and BuddyPress&#8217;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.GotchasDeleting a user flushes the object cache on this network, which drops every outstanding confirm token. Preview and apply one account at a time; several previews followed by several applies leave only the first apply working.A spam sender&#8217;s messages must be flagged as spam (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&#8217;s invitations table is read from buddypress()-&gt;members-&gt;table_name_invitations; BP_Invitation::get_table_name() is not public (fixed in 3.29.1)." ;
  sioc:topic <https://lhero.org/?taxonomy=author&term=cap-1> .

<https://lhero.org/author/1/#account> rdfs:seeAlso <https://lhero.org/author/1/?feed=lhrdf&format=turtle> .
<https://lhero.org/?taxonomy=author&term=cap-1> rdfs:seeAlso <https://lhero.org/?taxonomy=author&term=cap-1&feed=lhrdf&format=turtle> .
