---
title: Ability implementation notes
url: https://lhero.org/portfolio/lh-profile-page/ability-implementation-notes/
date: 2026-10-15T01:48:07+11:00
modified: 2026-11-29T06:13:13+11:00
type: lh-portfolio-doc
---

- **Part of:** [LH Profile Page](https://lhero.org/portfolio/lh-profile-page/)

- `create-or-fill-user` is `LH_Profile_Create_Or_Fill_User_Ability` (`includes/lh-profile-create-or-fill-user-ability-class.php`). It replaced `lh-buddypress-add-user/create-user` and needs LH User Provisioning, which resolves existing users by email or registered alias (`lh_user_provisioning_resolve_user()`) and, from 1.3.3, seeds a new user’s BuddyPress last activity from their registration date without ever bumping an existing value. Its profile field schema comes from `LH_Profile_Fill_Fields`.
- Since 3.26.3 `create-or-fill-user` runs every fill-if-empty test on the first name, last name, nickname and display name through `is_core_field_empty()`, so a value that is an email address or the login counts as an empty placeholder and can be filled. Accounts created by lh-email ingestion had their email address stored as `first_name`, so their real names were being skipped. A real name is still never overwritten.
- Since 3.30.0 filling an existing user never changes their site membership unless `add_to_site` is true (lh-tasks #155750). Before, an existing user with no role on the current site was always added to it with the unclaimed role. A fill run through Princes Park Touch’s site\_id once made 12 shawfactor.com contacts members of Princes Park Touch that way. Without `add_to_site`, `site` reports `not_on_site` or `no_role`, and LH User Provisioning is called with `add_to_site => false` (1.5.0+) so `ensure_user()` doesn’t add them either. Peter’s rule: never unless asked for. A new user is always added to the current site.
- `bulk-create-or-fill-users` (3.27.0) is `LH_Profile_Bulk_Create_Or_Fill_Users_Ability` (`includes/lh-profile-bulk-create-or-fill-users-ability-class.php`). It runs `LH_Profile_Create_Or_Fill_User_Ability::execute()` once per entry, so its rules are exactly the single ability’s, and each entry’s schema is the single ability’s `return_user_properties()` (everything but `dry_run`). It was added after a roster enrichment needed about 930 single calls. `dry_run`, and defaults for `existing_user` and (3.30.0+) `add_to_site`, are set once per batch; an entry’s own value wins. A repeated email in the batch is reported as `duplicate_email` and not run; a `WP_Error` or exception from one entry is reported as that entry’s `error` and the rest still run. The result drops skipped fields and any `site` that didn’t change (`already_on_site`, `not_on_site`, `no_role`), so a 100-user batch stays small. Batch size defaults to 100, filterable with `lh_profile_bulk_create_or_fill_users_return_max_users`. Schema validation still runs on every entry, so one malformed value (an invalid email, a gender outside the enum) refuses the whole call before anything runs; a dry run shows this first.
- `search-users` is `LH_Profile_Search_Users_Ability` (`includes/lh-profile-search-users-ability-class.php`). Since 3.8.0 it is the network’s only user-lookup ability. Other plugins extend it with the `lh_profile_search_users_input_properties`, `_result_properties`, `_restrictions` and `_results` filters: LH Membership adds membership status, and LH Contacts adds a signed short-lived `vcard_url` (LH Vcard did until LH Contacts replaced it).
- `update-user-profile` (3.15.0) is `LH_Profile_Update_User_Profile_Ability` (`includes/lh-profile-update-user-profile-ability-class.php`), the overwrite counterpart to `create-or-fill-user` for corrections such as membership triage fixes. It validates with `LH_Profile_Fill_Fields::validate_value()` and `LH_Profile_Known_As_Field::validate()`, then writes through `LH_Profile_Field_Saver` in overwrite mode with `clear_empty`. The confirm token is a site transient keyed by the token’s hash and bound to actor, user, site and the exact before/after values, as `set-primary-site` does. Who may use it mirrors `sync-display-name` and reuses its `return_claimed_roles()`: profile fields are network-wide, so `promote_users` only reaches users unclaimed on every site. Each apply records `account.profile_updated` in LH Audit Trail (member-visible, `retention_days` 0), with the lh-tasks `task_id` captured on `wp_ability_normalize_input` at priority 5, before lh-tasks strips it. Capabilities are filterable with `lh_profile_update_user_profile_return_capability` and `_return_unrestricted_capability`. No member notification, by decision.
- Since 3.16.0 `update-user-profile` takes `display_name_from`: the display name is built with `LH_Profile_Sync_Display_Name_Ability::return_options()` from the names as they will be after the change (overrides for `first_name`, `last_name` and `nickname`), never free text, and goes into the same preview, token and audit entry. A display name that followed a changed Known as is recorded too. `sync-display-name` records its writes through the public `LH_Profile_Update_User_Profile_Ability::record_audit()`, with the task from `take_task_id()`, so every display name change by ability is on the audit trail.