# One Setting for Store Locator Plus

## Current state

Core, Experience, Power, and Premier use the per-site shared option `slp_settings_0001` after verified cutover. The three add-on rows and core’s serialized JS and no-JS rows are retained as migration snapshots. Review the completed development cutovers and their readers and writers before publishing to staging or production.

The shared PHP array contains `schema_version => 1`, flat setting slugs, and the nested add-on `installed_version` map with `experience`, `power`, and `premier` entries as available. Migration copies each stored scalar version. The add-on admin upgrade writes the running package version after cutover. Core tracks its installed version separately in `csl-slplus-installed_base_version`. The four-digit option name leaves room for future selectable configurations such as `slp_settings_0002`. Selection semantics are deferred.

`slp_settings_0001_migration` is the single per-site bookkeeping row. Each module entry has a `keys` ownership map and a boolean `complete`. An absent entry means the module has yet to start. A false flag marks an interrupted or pending cutover and a true flag marks a verified cutover. A key can be reserved in the ownership map before any value is stored. Core uses `store-locator-plus`. Its ownership map stores the legacy group name for each core slug so each alias can project its own keys.

## Ownership and verification

- Use the [reviewed duplicate key map](one_setting_duplicate_key_list.md). The named owner’s stored value wins, including blank strings, zero, false, and null. If the key is absent, use an eligible stored core value. If both core groups offer different values and the map specifies neither group, stop and report the key. The map names core’s JS group as the source for `ignore_radius`.
- The add-on migration derives claims from its defaults, its audited ownership list and declared SmartOptions, and eligible extra keys from the legacy row. It omits request geography, admin display headings, and audited keys owned by another module. Shortcode attributes, selector URLs, and Power directory redirects still carry geographic request values. Experience owns the three persistent selector settings.
- The migration records pending ownership, writes and verifies the destination, rechecks the source rows it used, and records completion. Missing and empty source rows support application defaults and preserve their original storage state. A retry can complete with matching values. Invalid or reserved data, intersecting claims, and mismatched destination values stop cutover. Before a verified cutover, the logical alias reads its legacy row. A pending migration blocks writes to its affected settings.
- An add-on’s completed cutover carries its values and claims forward. The core cutover can reconcile older claims using current ownership rules. Check both claims and values before retiring a source. A stale claim can block a later cutover even when the key has no stored value. Preserve working settings when reconciling claims. A scoped reset can exercise the current rules on a disposable fixture.

## Add-on entry points

All three add-ons use `SLP_Shared_Settings::register_addon()`, `migrate_addon()`, and `set_addon_baseline()` with their explicit legacy option names. The catalog in `SLP_Shared_Settings` maps legacy aliases to migration entry names and groups historical duplicate keys by owner.

| Add-on and local package | Legacy alias | Current reader and writer path |
| --- | --- | --- |
| Experience `2612.01.06` | `slp-experience` | Registers its defaults and SmartOptions during `start_slp_specific_setup`. Translated defaults and legacy form saves use the add-on view. SmartOptions such as `search_box_title` read and write through their registered owner. Experience’s inline script selects display fields and leaves normal SmartOptions values in the core runtime payload. |
| Power `2612.01.02` | `slp-power` | Registers its add-on settings and declared SmartOptions during `start_slp_specific_setup` before core reads the JS and no-JS groups. Both paths use shared storage after cutover. Its activation path continues to install reporting tables, the category helper table, and contact fields. |
| Premier `2612.01.01` | `slp-premier-options` | Registers before core reads SmartOptions, like Power. Gated settings remain eligible for migration and their values load into SmartOptions when the feature is registered. Premier preserves defined bounds, recalculates location-based bounds when selected, and uses the WordPress scheduler for cron events. Its inline script and pagination response select display fields explicitly. Core owns subscription credentials and `dropdown_style`. |

Site-switch callbacks are registered in `add_hooks_and_filters()`. They can migrate an active tenant on first use and skip the switch during WordPress site-table initialization. Each add-on reloads its registered SmartOptions and add-on settings.

Core `2612.01.05` requires Experience `2612.01.06`, Power `2612.01.02`, and Premier `2612.01.01` when those add-ons are installed. Experience requires core `2612.01.05`. Power and Premier retain their previous minimum core version checks. The existing compatibility checks run in `SLP_BaseClass_Addon::initialize()` before early settings setup and `slp_init()`. Deploy matching packages and drain old workers before enabling cutover.

## Reads, writes, and rollback

- The legacy option names remain WordPress and application integration points. `SLP_WPOption_Manager` and `get_option()` return the shared owner projection and the scalar add-on version after cutover. The manager retains the logical option hooks and emits `slplus_update_wp_option` before persistence. SaaS Settings History reads the previous projection through the same legacy name.
- Writers compare submitted values against the baseline for the current site and merge only changed keys into a fresh database read while holding a per-site MySQL advisory lock. Routine saves preserve omitted keys and other modules’ values. The last successful write wins when two requests explicitly change the same key. An older browser form can submit stale values as explicit changes.
- SmartOptions keeps its JS and no-JS runtime groups, validation, and callbacks. Core routes registered owner changes to shared storage and preserves their old core copies. The SaaS domain switcher can read a core alias and save edits against that site’s captured legacy-view baseline. After a switch that reloads only add-on settings, a SmartOptions save persists only registered add-on changes. Saving core settings on a switched tenant requires a full SmartOptions load for that tenant.
- The write lock assumes one MySQL-compatible primary and a stable connection. It covers the shared writer path. Before a downgrade that must retain edits, quiesce writes and export each affected projection with its scalar version. Restore the core JS and no-JS views and any add-on SmartOptions that the downgraded code expects in those groups. Preserve the shared row and bookkeeping in the backup, and reconcile edits made by downgraded code before re-upgrading.

## Rally Creek development audit

On 2026-12-02, a read-only transaction through the local Docker container compared all five literal legacy rows in `wp_912_options` with `slp_settings_0001`. The audit used the reviewed ownership map, recorded owners, and exact PHP type-and-value comparisons. All 207 distinct eligible settings match their authoritative snapshots. All five legacy rows are present.

| Legacy row | Entries excluding version | Exact raw matches | Duplicate entries using their owner’s value | Intentionally omitted |
| --- | ---: | ---: | ---: | ---: |
| `csl-slplus-options` | 54 | 53 | 0 | 1 |
| `csl-slplus-options_nojs` | 105 | 100 | 4 | 1 |
| `slp-experience` | 33 | 30 | 0 | 3 |
| `slp-power` | 21 | 18 | 3 | 0 |
| `slp-premier-options` | 9 | 9 | 0 | 0 |
| Total | 222 | 210 | 7 | 5 |

- The five omitted slugs are the request-only `city`, `country`, and `state` and the display headings `map_appearance_cluster_header` and `map_controls_subheader`. Shared storage and migration metadata omit all five.
- The seven differing entries are copies of Experience-owned settings. The core no-JS copies are `map_options_scaleControl`, `map_options_mapTypeControl`, `label_for_name`, and `search_box_title`. The Power copies are `city_selector`, `country_selector`, and `state_selector`. All seven shared values match Experience’s stored inputs.
- All four migration entries are complete. Every stored setting has one claimant. Core owns 59 stored values, with 20 in its JS projection and 39 in its no-JS projection. Experience owns 53, Power owns 45, and Premier owns 50. Premier reserves `no_results_gf_id` and `no_results_gf_landing_page` without stored values.
- Shared `installed_version` matches the mounted Experience `2612.01.06`, Power `2612.01.02`, and Premier `2612.01.01` headers. The separate base version marker matches mounted core `2612.01.05`.

The 2026-12-01 audit preceded the core cutover and found six stale Experience claims. The completed core cutover removed the three geography claims and reassigned `ignore_radius` and `resultslayout` to the core JS view and `searchlayout` to the core no-JS view. Their shared values match those source rows.

## Core cutover and later client work

- Core migrates during `SLP_SmartOptions::slp_specific_setup()` after the add-ons register. Both core aliases read their portions of the shared row and retain the existing WordPress option hooks and Settings History names. Core SmartOptions saves use the same per-site write lock as add-ons. Full tenant setup reloads defaults from the current registration before applying the tenant data. Routine writes preserve omitted values, with an explicit path for deleting an obsolete core setting. Fresh activation leaves legacy groups absent and records the base version separately.
- Use the JS authority for `ignore_radius`. Keep `resultslayout` in the JS projection and `searchlayout` in the no-JS projection. Typed identical copies across the groups collapse to one value. Conflicting copies without a reviewed source stop cutover and report the affected slug.
- The cutover removes stale runtime and core claims from older add-on bookkeeping. It drops obsolete persisted request geography and takes the authoritative core values for core-owned keys. Existing add-on-owned shared values take precedence. Completed add-ons can receive missing eligible fallbacks and the required claims, including newly routed Experience SmartOptions. `results_box_title` is reserved for Experience based on its SmartOption definition. Inactive add-ons can use the retained core rows when they migrate later. An unexpected overlap with another recorded owner requires review.
- Audit access and response fields before redirecting public consumers. The existing core v2 GET `/options/all` combines the registered runtime groups and is anonymous, as are the existing single and filtered SmartOptions GET requests. Settings writes use `manage_slp_user`, and the single-setting write also validates the API key. SaaS Settings History registers a public, REST-visible post type. The complete shared array remains internal.
- The later client stage covers script localization, SaaS embed startup, tenant-aware caching, and a permissioned REST field list. Preserve startup ordering and explicit request-time overrides.

[Annotated SLP settings notes](https://internal.storelocatorplus.com/slp-settings-storing-and-retrieving-values/)

## Development verification

- Disposable WordPress 6.4.2 and 7.1.3 fixtures on PHP 8.3.2 and 8.5.12 verified Experience, Power, and Premier migrations, ownership and fallback handling, exact types, unknown keys, failures and retries, concurrent updates, and standalone and multisite isolation. The shared API fixtures also covered preserved completed cutovers, legacy alias reads without active add-ons, and mixed-version checks.
- The fixtures exercised nonce-validated add-on saves, Settings History callbacks, a joint Power and Premier SmartOptions save, core layout writes, radius overrides, Premier cron scheduling, defined bounds, gated settings with a stubbed Gravity Forms integration, and field filtering in Premier’s inline script and pagination response. PHP lint passed. Existing unrelated PHP diagnostics were noted during fixture work.
- The Rally Creek audit verifies persisted development data for site 912. Live SaaS browser behavior, persistent object-cache behavior, and downgrade execution remain unverified.

### Core cutover verification

Disposable WordPress 6.4.2 and 7.1.3 fixtures passed on PHP 8.3.2 and 8.5.12. They covered a core upgrade with all six earlier Experience claims from the Rally Creek audit, exact typed copies, identical and ambiguous cross-group values, retained snapshots, absent legacy rows on fresh activation, concurrent writers, and interrupted destination and completion writes. An Experience installation activated after core cutover successfully read its retained core fallback.

The fixtures also covered JS and no-JS saves, a nonce-validated settings form, logical history callbacks, the SaaS-style explicit read/modify/write path, tenant isolation, an obsolete-option deletion, the current REST response shape, and Experience inline settings and radius overrides. PHP lint passed. PhpStorm reported no errors and reported existing warnings. The 2026-12-02 Rally Creek audit separately verified the completed core cutover in the development database.
