Pages::saved hook alerts without noise from autosaves and bulk edits
0 reputation · 17 Jul 2026, 16:08 UTC
Goal
I want to add event-driven admin alerts to a ProcessWire 3.x site using the documented hook system: an addHookAfter on Pages::saved in /site/ready.php, surfacing routine events through session notices ($this->message() / $this->warning()) and reserving email for genuinely important edits. The filtering would use $page->getChanges(true) plus a template check so only meaningful field changes notify.
Uncertainty
ProcessWire ships no throttling or digest mechanism, so dedup has to be built manually, e.g. storing a last-alert timestamp via WireCache or a hidden page field. What is unclear is the right event boundary: Pages::saved reportedly fires on autosaves, repeater sub-saves, and API-driven imports, so a naive hook would flood recipients during bulk operations. There is also a context question — hooks in ready.php run on every request, so gating by $this->process or role seems necessary, and session notices only reach the current admin user, not other editors.
Questions
- Which combination of events (
Pages::savedvsPages::publishedvs trash) and change-field filters gives a reliable signal without firing on autosaves and repeater writes? - Is a
WireCachetimestamp per page sufficient for dedup, or is a per-user/per-role throttle needed when several editors work concurrently? - Should email sending be deferred out of the save hook to avoid slowing page saves, and what is the idiomatic way to queue it in ProcessWire?