Purpose
The contract between forms-manager and notifications-manager. Fired near the end of the submit handler (after the $entry array has been assembled from the submitted form data), gated on the handler’s $send_notifications flag. 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
);
The action is fired with two arguments — there is no result-envelope argument.
| Parameter | Type | Description |
|---|---|---|
$entry |
array | The assembled entry: form_id plus each submitted field keyed by field_id |
$form |
array | The full form definition (from mam_gf_get_form) |
Example: send a confirmation email after form 42 is submitted
add_action( 'mam_form_manager_send_notifications',
function ( array $entry, array $form ) {
if ( (int) $form['id'] !== 42 ) {
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, 2
);
The action only fires when the handler’s $send_notifications flag is true, so by the
time your subscriber runs the submission has already been accepted — there is no failed
result to guard against here.
Example: notify the listing owner
add_action( 'mam_form_manager_send_notifications',
function ( array $entry, array $form ) {
$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, 2
);
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
- Fires unconditionally, ignoring the handler’s
$send_notificationsgate
Going through the action:
- Lets admin overrides (and analytics, audit-logging, anti-spam) intercept
- Keeps the dispatch decoupled from your handler
- Respects the
$send_notificationsflag — a handler that sets it false suppresses all of these subscribers at once
Gotchas
- This is an action, not a filter. Returns are discarded.
- Only two arguments. There is no
$resultenvelope parameter — a subscriber declaring10, 3getsnullfor the third arg. - 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 |
