Filters answered by other plugins
lh_addresses_site_can_read( false, $viewer_id, $user_id, $blog_id ): whether the viewer may read the uses the site holds for the user. Answered by LH Membership since 2.110.0:promote_userson the site, and the subject a current member or a former one the site holds or has held an address for.lh_addresses_carry_use_on_move( $carry, $user_id, $blog_id ): whether a site’s use follows the member to a new address. Default: always for the own book (blog 0), and for a site while the user has an account there; LH Membership answers with real membership (current members only).lh_places_geocode( null, $fields ): returnsarray( 'lat', 'lng', 'accuracy' )or null for a structured address. To be answered by LH Places once LH Geocoding is folded into it (lh-tasks #155279).
Configuration filters
lh_addresses_return_address_types(default residential, postal, delivery, billing, work)lh_addresses_return_admin_capability(default install_plugins)lh_addresses_return_default_country_code(default: the site locale’s region)lh_addresses_geocode_batch_size(25),lh_addresses_geocode_max_attempts(5),lh_addresses_geocode_interval_microseconds(1,100,000),lh_addresses_geocode_time_budget(45 seconds)lh_addresses_return_backfill_batch_size(100),lh_addresses_return_backfill_source(lh_profile_meta),lh_addresses_return_backfill_meta_map(address field to LH Profile Page meta key; also used by the readers,set_user_parts()and the stray-write catch)lh_addresses_return_legacy_writes_kept(20): how many recent stray meta writes the record keepslh_addresses_init_plugin,lh_addresses_return_plugin_debugging_status
Actions fired
lh_addresses_saved( $id, $user_id, $changed, $existing ): $id is the new row when the address changedlh_addresses_replaced( $old_id, $new_id, $user_id )lh_addresses_use_added( $address_id, $user_id, $blog_id, $type ),lh_addresses_use_ended( $address_id, $blog_id, $type )lh_addresses_geocoded( $id, $lat, $lng )
LH Contacts 0.6.0 refreshes a member’s card on _saved, _replaced and _use_ended. Removed in 0.3.0: lh_addresses_use_removed, lh_addresses_site_uses_removed, lh_addresses_user_addresses_deleted.
Core hooks used
wp_privacy_personal_data_exporters registers the Addresses exporter (network-wide on the main site, site-scoped elsewhere). added_user_meta, updated_user_meta, deleted_user_meta and shutdown catch stray writes to the LH Profile Page address meta (see Legacy sync). Since 0.3.0 nothing hooks remove_user_from_blog, wpmu_delete_user or wp_privacy_personal_data_erasers.
Cron
lh_addresses_backfill (0.4.0): single events on the main site, every 30 seconds until done, 100 users per run in user ID order under a five-minute network lock. Visits only users with non-empty address meta, read straight from the user meta table, and passes each through the legacy sync. Progress is in the network option lh_addresses_backfill_progress (pass, last_user_id, seen, saved, skipped, failed, done, completed_at); raising return_pass() discards the stored state and starts again from the first user. It completed in pass 3 (6,280 users, 0 failed). Since 0.11.0 it changes nothing even if rerun: sync_user() is retired, because the meta is no longer kept current. It never added club uses: LH Membership does that.
lh_addresses_geocode_queue, every five minutes on the main site. Takes pending addresses, then failed ones whose backoff (2 to the power of attempts, in hours) has passed, and geocodes up to the batch size at no more than one request per second, under a two-minute network lock. After five failed attempts an address is marked skipped. Does nothing when no geocoder answers lh_places_geocode. A single invalid_schedule notice for its reschedule can appear if cron runs while the plugin is momentarily deactivated (for example during a code apply); it reschedules normally on the next load.

