Status: Deployed in commit 541d3db2.
Built the full scope of the original request. Admins can now customise the weekly digest from /admin/email/digest with no code changes.
What admins can configure
- Branding — header image URL (above the greeting), brand colour (drives the CTA background + accent links)
- Greeting and sign-off — custom intro text (replaces the default "Here is your weekly roundup…") + custom outro text (appears above the CTA)
- CTA button — text + URL (internal path like
/forums, or absolute https://…)
- Section toggles — 7 toggles to show/hide:
- Your forums this week (per-recipient)
- Featured threads (pin up to 3)
- Top posts this week
- Most active threads
- New file uploads
- Upcoming events
- New members this week
- Featured threads — comma-separated thread IDs (max 3), pinned at the top of every digest when the section is on
- Email me a preview button — sends a test render to the admin's own inbox using current saved settings
Under the hood
- New table
digest_settings — single-row config (id = 1 enforced) per tenant. Migration applied to support, fort-smith-live, dev.
- New model
App\Models\DigestSettings — get(), save(array $fields), featuredIds().
- New controller
AdminEmailDigestController — show(), save(), test(). All actions audit-logged.
- Routes added to the
/admin group: GET /email/digest, POST /email/digest/save, POST /email/digest/test.
- Renderer
templates/email/weekly-digest.php gates every section on $_show() with safe defaults (every original section defaults ON), adds the header-image / intro / outro / featured-threads / config-driven CTA blocks.
- Sender
bin/send-weekly-digest.php loads settings + featured-thread rows once at the top of the cron and passes them into every per-user payload — no per-user query overhead.
Backwards-compatible: any deployment that hasn't visited /admin/email/digest will get a row of defaults inserted on first read. Legacy callers that don't pass digestCfg still render the default digest layout because every $_show() defaults ON.
Live on all three tenants. Locking thread.