---
title: Database Schema
url: https://lhero.org/portfolio/lh-profile-page/database-schema/
date: 2026-09-09T01:46:07+10:00
modified: 2026-11-22T11:42:16+11:00
type: lh-portfolio-doc
---

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

# Database Schema (User Meta Fields)

Phone numbers are stored by LH Phone Numbers, a required plugin since 3.21.0, in its network tables; read them with `LH_Profile_Phone_Field::return_user_phone()` or LH Phone Numbers’ own API. Addresses are stored by LH Addresses (below). Every other field is stored as **user meta** (`wp_usermeta`), under the plugin's namespace prefix `lh_profile-`. LH Profile Page has no database table of its own.

**Addresses are stored by LH Addresses**, a required plugin since 3.26.0 (lh-tasks #148769). The field saver (since 3.22.0) and fill-fields (since 3.23.0) store the five address inputs through `LH_Addresses_Legacy_Sync::set_user_parts()`, which saves the member's own address in LH Addresses' tables. Every reader in this plugin reads the tables: `LH_Profile_Phone_Field::return_user_meta()` for single values, search-users for its address filters, and the Users Insights joins. Since LH Addresses 0.11.0 (22 Nov 2026) the `lh_profile-*` address keys below are no longer kept up to date: they hold whatever they held then, until they are deleted. Don't read or write them. A stray write is still caught by LH Addresses, applied to the member's address and recorded. Since 3.26.2 LH Contacts follows LH Addresses' own actions for card changes, not these keys.

## Registered meta (validated via `register_meta()`)

These fields have a `sanitize_callback` registered, so **any** direct `update_user_meta()` write – from this plugin, the REST API, or any other plugin – is validated/normalised, not just writes that go through this plugin's own save paths.

| Meta key | Type | Format | Notes |
|---|---|---|---|
| `lh_profile-phone` | string | E.164 (`+61...`) | **Legacy, no longer kept up to date.** Holds whatever it held when LH Phone Numbers 0.12.0 stopped mirroring numbers into it (21 Nov 2026); not shown in REST. A direct write is still validated (with LH Phone Numbers' normaliser) and copied into LH Phone Numbers. To be deleted in lh-tasks #155226. |
| `lh_profile-secondary_phone` | string | E.164 | Legacy, as phone. |
| `lh_profile-gender` | string | `Male`\|`Female`\|`Organisation`\|`Robot` | Fixed allowed-value set. |
| `lh_profile-birthdate` | string | `Y-m-d` | Changed from a UNIX timestamp to a plain date string in v2.13 – see Architectural Notes for why, and the full migration history. |
| `lh_profile-street_address` | string | free text | **Legacy, no longer kept up to date.** Mirror of LH Addresses from 3.22.0 until LH Addresses 0.11.0 (22 Nov 2026). `sanitize_text_field()` only. A direct write is applied to the member's address in LH Addresses and recorded. To be deleted after lh-tasks #155341, asking Peter first. |
| `lh_profile-town` | string | free text | Legacy, as street address. |
| `lh_profile-postcode` | string | free text | Legacy, as street address. LH Addresses validates the postcode against the country's format. |
| `lh_profile-state_province` | string | free text | Legacy, as street address. LH Addresses maps it to a subdivision code (VIC). |
| `lh_profile-country` | string | free text | Legacy, as street address. LH Addresses maps it to an ISO code. |

## Unregistered meta

| Meta key | Type | Notes |
|---|---|---|
| `lh_profile-birthdate_readable` | string | Companion field alongside `lh_profile-birthdate`, written by `handle_birthdate_update()`. Historically held the pre-parse date string; since the v2.13 format change both fields hold the same `Y-m-d` value, making this field largely redundant going forward, but it's kept for backward compatibility since other code (`filter_query_joins()` for the "Users Insights" plugin integration) reads it directly. |
| `lh_profile-emails` | array | Additional/secondary emails, serialized array of validated email strings. **Slated for removal** – superseded by `lh-user-identity`. Not extracted into its own field class for this reason. As of this session, 1,888 users have a non-empty value here, largely following a `firstname.lastname@theaustraliatimes.com.au` &lt;-&gt; real-email cross-reference pattern that turned out to indicate a large number of duplicate user accounts – see the exploration brief referenced in Architectural Notes. |
| `lh_profile-updated_time` | int | UNIX timestamp of the last time any "non-native" field (see below) was updated. Set by `track_last_meta_update_time()`. |
| `lh_profile-updated_field` | string | Which meta key was last updated, alongside `updated_time`. |

## Core WordPress fields (not this plugin's own meta)

| Field | Storage | Notes |
|---|---|---|
| First name | `first_name` usermeta (WP core key) | No `register_meta()` here deliberately – registering a sanitize\_callback against a core-recognised key would affect any other code touching that exact key, not just this plugin. |
| Last name | `last_name` usermeta (WP core key) | Same reasoning as first name. |
| Display name | `wp_users.display_name` column | Not usermeta at all – `register_meta()` doesn't apply. |

## "Non-native fields" list

`return_all_non_native_fields()` returns: `street_address`, `town`, `postcode`, `gender`, `phone`, `birthdate` (all namespace-prefixed). This list drives several cross-cutting behaviours: notification token generation, the "updated\_time"/"updated\_field" tracking, the `prevent_bad_meta_values` filter (rejects empty-string writes to any of these keys), and LH Contacts card tracking (with the phone and address keys left out since 3.26.2: LH Contacts follows LH Phone Numbers and LH Addresses for those). Because address saves no longer write the meta, they no longer move `updated_time`/`updated_field`.