Skip to content

Saved Items & Member Profiles

Account provides two closely linked member-state features: single-owner Member Profiles and multi-list Saved Items.

Single-Owner Member Profiles (profile_source)

Section titled “Single-Owner Member Profiles (profile_source)”

To prevent split-brain member data, Account reads and writes extended profile fields from exactly one configured source:

  • entry (Default): Profiles live in the account-profiles Entries collection. Core ProcessWire user pages stay clean with zero schema mutations.
  • user (Opt-In): Profiles live directly on ProcessWire User pages via an embedded @fieldset:account-profile field installed by account:scaffold:user --allow-user-template --activate. Editing a member from Setup -> Account -> Members links to page-edit/?id={id}.
In default entry mode, member profiles are managed directly in Setup -> Account -> Members without altering ProcessWire system templates.

Read a member’s profile and summary in PHP:

<?php namespace ProcessWire;
$account = Account::requireInstance($wire);
$profile = $account->profile($user);
$summary = $account->accountSummary($user);

Multi-List Saved Items ($account->saved())

Section titled “Multi-List Saved Items ($account->saved())”

Members and anonymous visitors can save ProcessWire pages, Entries items, or custom entities into named lists such as favorites, wishlist, and compare.

  • Signed-In Members: Records persist in entries_tbl_account_saved_items.
  • Guest Visitors: Selections persist in an HMAC-signed account_saved cookie and merge automatically into the member’s database lists upon sign-in or registration.
<?php namespace ProcessWire;
$account = Account::requireInstance($wire);
$saved = $account->saved();
// Toggle an item for the current user or guest cookie context
$state = $saved->toggleForContext('favorites', 'page', (string) $yacht->id);
// List resolved saved items for the current context
$items = $saved->listForContext('favorites');

Declarative Frontend Toggle ([data-account-save-toggle])

Section titled “Declarative Frontend Toggle ([data-account-save-toggle])”

When dist/AccountFrontend.js is loaded, any button with data-account-save-toggle automatically hydrates state via GET /auth/action/saved_state, toggles via POST /auth/action/saved_toggle with CSRF protection, and dispatches the browser account:saved:changed custom event:

<button
type="button"
data-account-save-toggle
data-account-list="wishlist"
data-account-type="page"
data-account-key="1042"
aria-pressed="false"
>
Add to Wishlist
</button>

Custom Item Resolvers (SavedItemResolverInterface)

Section titled “Custom Item Resolvers (SavedItemResolverInterface)”

Account ships PageSavedItemResolver (which also integrates with Media thumbnails when allowLibrary is enabled). For custom item types (such as Entries blueprints or external SKUs), implement SavedItemResolverInterface or hook Account::resolveSavedItems to enrich saved keys with titles, URLs, prices, and thumbnails.

Next steps