Legacy sync

The bridge from LH Profile Page’s lh_profile-* address meta (lh-tasks #148769). Since 0.11.0 (stage 5, 22 Nov 2026) the tables are the only store. Nothing mirrors addresses into the meta any more, so the meta keeps whatever it held when the mirror stopped, until it is deleted (stage 6, asking Peter first). Every writer calls set_user_parts(), every reader calls get_meta_value(), find_user_ids() or own_residential_subquery(), and a stray write to the meta is still caught and recorded.

Writing through LH Addresses

LH_Addresses_Legacy_Sync::set_user_parts( $user_id, $parts ) takes some or all of address_line1, locality, postal_code, administrative_area and country_code as typed (” clears a part; the country may be a name such as Australia). address_from_table() overlays them on the member’s current own residential address in the tables, so parts not given keep their current value there, and the result is saved. Returns created, replaced, unchanged or ended, or a WP_Error. Since 0.11.0 nothing is written to the meta. Before that, the parts were overlaid on the meta and mirrored back into it (0.7.0 to 0.10.0).

Writers, each storing all the parts of one save together: LH Profile Page’s field saver (3.22.0; profile forms, admin forms, check-ins, CRM, update-user-profile) and fill-fields (3.23.0; create-or-fill-user), LH Mysideline’s CSV import (1.6.0) and LH Multisite Importer (1.0.2). All three plugins require LH Addresses and have had no direct-meta fallbacks since stage 4 (LH Profile Page 3.26.0, LH Mysideline 1.7.0, LH Multisite Importer 1.1.0). No other code on the network writes the keys.

Reading through LH Addresses

Three readers, each taking an LH Profile Page address meta key and answering from the member’s current own residential address. Each returns null when the key is not an address key or the tables are not at their current schema. LH Profile Page then reads usermeta after get_meta_value() and own_residential_subquery(), because those code paths also serve non-address keys (gender, birthdate). search-users treats a null from find_user_ids() as no matches (since 3.26.1).

Readers moved: LH Profile Page 3.24.0 to 3.26.1 (LH_Profile_Phone_Field::return_user_meta() and so the fill-if-empty checks, CRM, check-ins, reports and update-user-profile; the five address inputs, xProfile and the backend profile table; contact cards; search-users results and filters; Users Insights), and LH Mysideline 1.7.0 (the CSV import’s fill rule). LH Contacts 0.6.0 refreshes cards on this plugin’s actions, and LH Profile Page 3.26.2 stopped asking it to watch the address meta keys. fill-fields counts an address part as filled when set_user_parts() succeeds, with no meta readback.

Stray writes to the meta

added_user_meta, updated_user_meta and deleted_user_meta on any of the five keys note the user and the key. On shutdown each user’s written keys are read (a deleted key counts as ”) and overlaid on their address in the tables with address_from_table(), with the same results as set_user_parts(). Keys that were not written are never read, since they are stale; before 0.11.0 all five keys were copied together, which would now roll the other parts back.

The first such write per user per request is recorded in the network option lh_addresses_legacy_meta_writes (count, first_at, last_at, and the last 20 with user, key, action and caller; filter lh_addresses_return_legacy_writes_kept). Every entry names code that still writes the meta directly. A quiet record for a while, with the checks in lh-tasks #155341, is the cue to ask Peter about deleting the meta.

Retired in 0.11.0

The full copy from the meta to the tables: sync_user() now changes nothing and returns skipped, so the backfill (complete, pass 3: 6,280 users) can no longer write. The lh-addresses/resync-users ability, which ran it on demand, is removed. Both would have copied stale meta over addresses changed since.