Purpose
The contract between forms-manager and notifications-manager. Fired after a form submission completes (after the result envelope is built but before the JSON response is returned). Subscribers fire do_action('mam_notification_send_message', $msg) to dispatch confirmation emails, owner alerts, admin notifications, etc.
⚠️ Don’t fire mam_notification_send_message directly from form-handling code. Go through this action so admin overrides can intercept the notification dispatch.
Signature
do_action(
'mam_form_manager_send_notifications',
array $entry,
array $form,
array $result
);
| Parameter | Type | Description |
|---|---|---|
$entry |
array | The GF entry that was just submitted |
$form |
array | The full GF form definition |
$result |
array | The result envelope (status, message, redirect, etc.) being returned to the app |
Example: send a confirmation email after form 42 is submitted
add_action( 'mam_form_manager_send_notifications',
function ( array $entry, array $form, array $result ) {
if ( (int) $form['id'] !== 42 ) {
return;
}
if ( ( $result['status'] ?? '' ) !== 'success' ) {
return;
}
do_action( 'mam_notification_send_message', array(
'message_type' => 'mam-my-plugin-form42_submitted',
'recipient_id' => (int) ( $entry['created_by'] ?? 0 ),
'replacements' => array(
'submission_summary' => $this->format_summary( $entry ),
),
) );
},
10, 3
);
Example: notify the listing owner
add_action( 'mam_form_manager_send_notifications',
function ( array $entry, array $form, array $result ) {
$listing_id = (int) ( $entry['post_id'] ?? 0 );
if ( ! $listing_id ) return;
$owner_id = (int) get_post_field( 'post_author', $listing_id );
do_action( 'mam_notification_send_message', array(
'message_type' => 'mam-my-plugin-listing_inquiry',
'recipient_id' => $owner_id,
'replacements' => array(
'listing_title' => get_the_title( $listing_id ),
'inquirer_email' => $entry['email'] ?? '',
),
) );
},
10, 3
);
Why go through this action
Direct mam_notification_send_message from a form handler:
- Bypasses any admin-side intercept registered against
mam_form_manager_send_notifications - Couples your handler to the dispatcher’s interface
- Can fire even when the result envelope shows
status = failure
Going through the action:
- Lets admin overrides (and analytics, audit-logging, anti-spam) intercept
- Keeps the dispatch decoupled from your handler
- Gives the result envelope a chance to suppress notification on failure
Gotchas
- This is an action, not a filter. Returns are discarded.
- Always check
$result['status']— don’t send confirmation emails for failed submissions. - Always gate on
$form['id']— the action fires for every form submission; without a guard, your handler runs for forms it shouldn’t. - Can fire multiple subscribers per form. A welcome email + an owner alert + an admin moderation queue can all hook here for the same form.
- No batch optimization. Each subscriber fires
do_action('mam_notification_send_message')individually; if 5 subscribers each send a notification, that’s 5 dispatcher calls (each writing its own history rows).
Related articles
- Forms manager overview
- Form submission lifecycle
- Notifications overview
- Hook: mam_notification_send_message
- Hook: mam_for_gravity_forms_formsubmitted{id}
Metadata
| Field | Value |
|---|---|
| Article type | Hook Reference |
| Plugin slug | mam-main |
| Applies to plugin version | 2.1.11+ |
| Hook type | action |
| Audience | PHP developer |
| Frozen contract | yes |
| Last verified | 2026-05-02 |
