Helping Organisations get organised!

Changelog

  • 0.2.4: Requires PHP 8.1. doctrine/collections 3.x, which commerceguys/addressing 2.3 depends on, needs PHP 8.1, so the plugin header and composer.json now say so instead of 8.0. No code change.
  • 0.2.3: Simplifies the required-field check in address validation. commerceguys/addressing returns a country’s required fields as plain strings (AddressField constant values); the enum handling added in 0.2.2 was unnecessary and is replaced with a direct intersection against the fields LH Addresses stores. No change in behaviour.
  • 0.2.2: commerceguys/addressing 2.3 is now installed with Composer, so address validation (valid, incomplete or invalid for the country’s format and postcode pattern) and state-name mapping (Victoria or Vic to VIC) are active. Also adds handling for the library’s required fields arriving as enum cases; this proved unnecessary and was simplified in 0.2.3, with no change in behaviour.
  • 0.2.1: The user-deletion and geocoding cron hooks now go through small handler methods that return nothing, instead of hooking functions that return a count or a result array directly. No change in behaviour; found by static analysis.
  • 0.2.0: First working release of LH Addresses: structured, international postal addresses for users, stored network-wide and shared with the organisations (sites) they belong to. Three tables on the main site: lh_addresses (CLDR address fields as used by commerceguys/addressing, plus source, validation and geocoding status), lh_address_uses (which address fills which type for whom: blog 0 is the member’s own address book, any other blog ID means the address has been given to that site’s organisation) and lh_address_geo (one point per geocoded address, with a spatial index). Tables are created and upgraded from a schema version, not the plugin version. The LH_Addresses_Api class saves and normalises addresses (subdivision names such as Victoria or Vic become VIC; postcodes upper-cased; missing country taken from the site locale), records whether each address is valid, incomplete or invalid for its country without ever refusing a save, keeps at most one current address per user, site and type, and answers reads through access rules: users see their own addresses, install_plugins sees all, and anyone else sees only addresses given to a site when the lh_addresses_site_can_read filter allows it (answered by LH Membership). It also offers a near-point search over a site’s addresses using the spatial index. Geocoding is queued: saving or changing an address marks it pending, and a five-minute cron on the main site sends due addresses through the lh_places_geocode filter (answered by LH Places) at no more than one request per second, retrying failures with backoff and skipping an address after five attempts; without a geocoder addresses simply stay pending. Removing a user from a site removes that site’s uses of their addresses, and deleting a user from the network deletes all of their addresses, uses and points. WordPress personal data export and erasure include addresses: on the main site they cover everything, on other sites only what was given to that site. Adds a write_log() helper, Requires at least 6.7 and Requires PHP 8.0 headers, and a Composer manifest for commerceguys/addressing (validation and subdivision mapping are skipped until it is installed).
  • 0.1.0: Initial scaffold.

If you like this plugin please consider making a donation to further development