Accounts (Hub)
File locations
/core/assets/database/tenants/<tenant>/accounts.sqlite
accounts
Canonical identity + cross-plugin bridge pointers.
Key fields
- id (PK)
- username, email, password
- role, account_status, email_verified, verification_status
- profile_id, business_listing_id, channel_id, affiliate_id
- parent_affiliate_id
Contracts
- Bootstrap rule: when an account is created, pointers default to id (profile_id=business_listing_id=affiliate_id=channel_id=id).
- Never rely on other plugins for identity display; always load username/email from accounts first.
accounts_affiliate_codes
Referral/share key registry (key -> account_id).
Key fields
- affiliate_key (PK, NOCASE)
- account_id
- kind (code|slug)
- created_at, updated_at
Contracts
- Resolve ?ref=... using accounts_affiliate_codes first.
- Keys are unique case-insensitively.
Preferred helpers
accounts_current_tenant()accounts_db($tenant): ?PDOaccounts_get_by_id($pdo, $id): ?arrayaccounts_affiliate_ensure_keys($pdo, $accountId, $username): array{code,slug}accounts_resolve_parent_affiliate_id($pdo, $refKey, $default=100002): int
Routes
/client-main-dashboard (example hub consumer route)/accounts-cheatsheet (this page)