Notifications
One bell and one email system for every XPAC plugin: edit the messages, let each user pick what they get, and watch every send in a queue.
Notifications is the engine the other XPAC plugins send through. A plugin says "this user should hear about this", and Notifications stores the notice, rings the bell, and sends the email in the background. You edit the wording, decide what is on, and see what was sent. Users choose for themselves what they receive.
It works on its own. It uses Realtime to update the bell without a refresh, and SendGrid or Brevo when you want a provider to send the email.
Where to find it
XPAC → Notifications in wp-admin. The bell and the preferences list are blocks you put on a page or in the header.
Quick start
Admin screens
| Screen | What it is for |
|---|---|
| Templates | Every type and how its email goes out. Edit, preview, send a test to yourself, or reset to the default |
| Deliveries | Every email and integration send, with its status. Retry what failed. Resume a paused channel |
| Settings | One tab per section of types, such as Users. Each type has an On-site and an Email switch |
On-site decides if the bell gets the notice. Email decides if an email goes out.
The sender of an email is set on its template, in the editor's Settings panel, as From name and From address; empty leaves them to WordPress or your mail plugin. Every email links to the first published page that holds the Notification Preferences block, so put the block on any page.
Integrations have no page of their own. SendGrid, Brevo, Webhooks and Zapier each add their part to a template in the editor while their plugin is active, like they do for a form.
Templates and tags
Templates are edited in the block email editor. A template is made the first time you open a type, so untouched types keep the plugin's own wording. Reset to default brings the original back.
Every email's blocks sit in the template's Content block. Choose Edit template, select Content and change its background, border and padding; the change reaches every email. Styles › Background colours the space around it. The logo row and footer belong to the Notification email template that every email shares; change them with Edit template.
| Field | What it is |
|---|---|
| Subject | Plain text. Tags work here. HTML is dropped |
| Email body | Blocks, with tags in text and in links |
The bell line
Each row of Templates shows the line the bell shows, with its icon. Change edits both in the row, then Save.
- Icon: the type's own, a picture the notice brings (such as the sender's photo or a rank badge), the site icon, or any image from the media library. A notice without that picture keeps the type's own icon.
- Text: one line. Insert tags from Insert tag; they are written
{name}. Leave it empty to use the plugin's own text. Changing the text keeps the icon.
Write a tag as [xpac/name]. Inside text the editor keeps it as <!--[xpac/name]-->. Add a
fallback with [xpac/name default="there"].
| Tag | Value |
|---|---|
siteName, siteUrl, siteLogoUrl | Your site and its logo |
recipientName, recipientFirstName | The user getting it |
typeTitle, noticeTime | What kind of email it is, and when the notice was stored |
noticeLink, noticeMessage, actionLabel | Where it points, the plugin's own message, and the button's label |
preheader | The preview line mail apps show under the subject |
count, amount | How many events it covers, and their sum |
preferencesUrl, footerNote, footerLinks | The preferences link, why the email came, and the footer links |
profile-<field> | The recipient's answer to a profile field, with User Profiles active |
A type can add its own tags, such as the sender of a message. They show in the editor's tag
list. A _ in a profile field's key is written - in its tag.
If the email editor causes trouble on a site, return false from the
xpac_notifications_block_emails filter. Emails then come from the plugin's PHP templates.
Grouped notices
Some types keep one running notice per thing instead of many: ten events on one thing are one notice, and its count reads 10. When the user reads it and another event arrives, the notice comes back as new and the count starts again. A type that carries an amount shows the sum.
The preferences block
Notification Preferences lists every type a user can choose, grouped by section.
| Part | What it does |
|---|---|
| On-site and Email toggles | Shown only for channels the type has and you left on |
| Always on | Types users cannot turn off, such as a password reset |
| All emails | One switch for every email except account emails. The individual choices are kept for when it is turned back on |
| Section headings | Can be hidden in the block settings |
A change saves as soon as the user makes it. The block settings let you include or exclude types and rename the labels. The Notification Preference block shows a single type, with a channel option: All, On-site or Email.
Deliveries and pause rules
Email, SendGrid, Brevo, webhooks and Zapier all send from one queue. Nothing is sent while the page loads, except a few account emails (welcome) that go out at once.
| Rule | How it works |
|---|---|
| Retries | Five tries, waiting 1 minute, 5 minutes, 30 minutes, then 2 hours. A provider's own "retry after" is respected |
| Pause | A channel or endpoint pauses after five failures in a row. It is tried once an hour |
| Pause notice | You get one email when something pauses, and a notice in wp-admin until it is resumed |
| Resume | Resume and retry clears the pause and queues the failed sends again |
| Delay | A type can wait before emailing and send only while the notice is still unread; its own page says so |
| Cleanup | Old settled deliveries are deleted after 30 days. Notices are deleted after six months |
Plain email always uses wp_mail(). If you already send with an SMTP plugin, it is used.
A type with a SendGrid or Brevo template picked sends through that provider instead.
Turn on email
A site that moves from Community Platform's notifications with a SendGrid key saved starts with plain email paused, so people who never got these emails do not suddenly get them. The Templates screen says so and offers Turn on email. Only notices stored after you turn it on are emailed.
Privacy
Notifications adds to WordPress's export and erase tools: the user's notices, their preferences and their deliveries are exported, and erased when the user is.