vestnik.dispatcher plugin

Vestnik1 min readPage 3 of 12
On this page 3

vestnik.dispatcher is installed with the component. It listens to the MODX system events it is attached to, turns their data into placeholders and passes it to Vestnik. Without an event attached and without a rule the plugin does nothing.

How to use it

  1. Attach the plugin to an event: Elements → Plugins → vestnik.dispatcher → System Events → tick the ones you need (for example OnWebLogin, OnDocPublished) → Save. After installation the plugin is attached to OnUserActivate and OnManagerLogin.
  2. Create a rule whose “Event key” is the exact MODX event name, for example OnUserActivate (case-sensitive).
  3. Use the event placeholders in the template (table below).

Placeholders

MODX eventPlaceholders
Any (always)[[+event]], [[+site_name]], [[+site_url]]
OnUserActivate, OnUserSave, OnUserRemove, OnUserFormSave, OnWebLogin, OnManagerLogin[[+user_id]], [[+username]], [[+email]], [[+fullname]]
OnDocPublished, OnDocFormSave[[+resource_id]], [[+pagetitle]], [[+longtitle]], [[+url]]

In addition, all scalar properties of the event get into the template under their own names.

Common mistakes

  • The event key in the rule does not match the MODX event name (case matters) — the rule never fires.
  • Saving a user in the manager fires OnUserFormSave, not OnUserSave.
  • Nothing arrives — turn on vestnik_debug_mode: the MODX error log will show [Vestnik] lines telling whether the event fired and how many rules matched. In this mode all emails go to vestnik_debug_email, and without it they are not sent.