Skip to content

Plugin Template Creation

This guide is for plugin and theme developers who want ready-made notification templates to appear inside Notificator. Register the underlying event as well when you want accurate, scan-free discovery.

A template pre-fills scenario settings in the admin UI:

  • hook_name
  • description
  • scenario_name
  • optional hook_meta
  • optional prefilled conditions

Add this in your plugin/theme bootstrap:

<?php
add_action('notificator_companion_register_templates', function () {
if (!function_exists('notificator_companion_register_template')) {
return;
}
notificator_companion_register_template(array(
'icon' => 'dashicons-admin-generic',
'title' => 'My Plugin: Something Happened',
'hook_name' => 'my_plugin_event',
'description' => 'Fires when my plugin event runs',
'scenario_name' => 'My Plugin Event',
'required_plugin' => 'my-plugin-slug',
'hook_meta' => array(
'label' => 'My plugin event',
'type' => 'action',
'arg_names' => array('user_id'),
'payload_arity' => 1,
),
'conditions' => array(
array(
'field' => 'user_id',
'operator' => '>=',
'value' => '1',
'value_type' => 'number',
'value_label' => 'User ID at/above',
'value_placeholder' => '1',
'locked' => true,
'lock_field' => true,
'lock_operator' => true,
),
),
));
});

If you also register an event with the same plugin_slug, Notificator automatically treats that template group as active.

For a template-only integration, add a custom required_plugin slug to the active identifiers:

add_filter('notificator_companion_active_plugin_identifiers', function ($ids) {
$ids[] = 'my-plugin-slug';
return $ids;
});

If you do not want custom slug handling, set:

  • required_plugin => wordpress-core
  • icon string: Emoji or Dashicon class.
  • title string: Card title in template picker.
  • hook_name string: Target hook.
  • description string: Short explanation.
  • scenario_name string: Default scenario name.
  • required_plugin string: Filtering key.
  • hook_meta array: Hook metadata (arg_names, payload_arity, etc.).
  • conditions array: Prefilled condition rules.
  1. Activate your plugin and Notificator.
  2. Open Notificator → Notifications → Templates.
  3. Confirm your template appears in its plugin group.
  4. Apply template and save scenario.
  5. Trigger the hook and verify notification arrives.