Hook: mam_notification_list

Purpose

The notification-type registry. Every notification type — bundled or sibling-plugin — registers its definition by hooking this filter. The dispatcher looks up $message['message_type'] against the registry to:

  • Resolve which channels to send through (per-channel opt-in option keys + the type’s default_on)
  • Apply the type’s templates with replacement tokens
  • Surface the type in Mobile App Manager → Notifications → Settings

68+ subscribers register types here.


Signature

$types = apply_filters( 'mam_notification_list', array() );
Parameter Type Description
array() array Array of type definitions

Returns: array — the augmented registry.


Type definition shape

array(
    'source'          => 'mam-my-plugin',                 // plugin slug
    'title'           => 'Order Shipped',                 // human-readable
    'slug'            => 'mam-my-plugin-order_shipped',   // unique
    'replacements'    => array( 'order_id', 'tracking_number', 'user_login' ),
    'default_content' => 'Your order [order_id] has shipped.',
    'default_on'      => array( 'email', 'push' ),        // channels enabled by default
    'description'     => 'Sent when an order is fulfilled.',
)

Field reference: see Notification types registry.


Example: register a new type

add_filter( 'mam_notification_list', function ( array $types ): array {

    $types[] = array(
        'source'          => 'mam-my-plugin',
        'title'           => 'New Reservation',
        'slug'            => 'mam-my-plugin-new_reservation',
        'replacements'    => array( 'reservation_date', 'reservation_time', 'user_login' ),
        'default_content' => 'A new reservation was made for [reservation_date] at [reservation_time].',
        'default_on'      => array( 'email', 'push' ),
        'description'     => 'Sent to venue owners when a reservation is created.',
    );

    return $types;
} );

Example: enumerate subscribers

$all_types = apply_filters( 'mam_notification_list', array() );
echo "Registered notification types: " . count( $all_types );
foreach ( $all_types as $type ) {
    echo "- {$type['slug']} (from {$type['source']})n";
}

Useful when diagnosing slug collisions.


Bundled types

Registered by mam_notifications_list::mam_notification_list():

Slug Title Default channels
mam-user-roles-welcome_email User Roles – Welcome Email (none)
mam-user-roles-lost_password User Roles – Lost Password email
mam-user-roles-login-with-email User Roles – Signup Email Verification email
mam-push-notification General Push Notification (none)

Gotchas

  • Slug collisions are silently catastrophic. Two plugins registering the same slug produce last-writer-wins; the loser’s templates are ignored. Always prefix slugs with your plugin slug.
  • Filter runs on every dispatcher call. Don’t do heavy work in the subscriber — just append the type definition. The dispatcher caches the resolved registry per request.
  • The four bundled types can’t be unregistered safely — the bundled login/registration/lost-password flows depend on them.
  • default_on is a default, not a force-on. Admins can toggle channels off in the UI.
  • Replacements without brackets in the registry; with brackets in templates ([user_login]).
  • Adding a type at runtime affects only requests after the registration takes effect — not the current request that called the dispatcher (the registry was already cached).

  • Notifications overview
  • Notification types registry
  • Notification template replacements
  • Recipe: Register a notification type
  • Hook: mam_notification_send_message
  • Frozen public contracts reference

Metadata

Field Value
Article type Hook Reference
Plugin slug mam-main
Applies to plugin version 2.1.11+
Hook type filter
Audience PHP developer
Frozen contract yes — 68+ subscribers
Last verified 2026-05-02
Contents

    Need Support?

    Can’t find the answer you’re looking for? Don’t worry we’re here to help!