Hook: mam_gravity_forms_after_form_processed_{form-id}

Purpose

Per-form post-collection filter fired inside mam-main’s standard form handler (gf_standard_form()) once the app-submitted field values have been gathered. When a subscriber is attached for a given form id, its return value becomes the response envelope sent back to the app (replacing the default go_home response). Use it to run side effects and shape the response for a specific form.

Distinct from mam_for_gravity_forms_form_submitted_{form-id}, which fires in the separate submit-app-form path (with $form_id, $post_id, $values).


Signature

$result = apply_filters(
    'mam_gravity_forms_after_form_processed_' . $form_id,
    array $values
);
Parameter Type Description
$values array The collected submitted field values for this form (from mam_gf_get_form_data)

Returns: array — the response envelope returned to the app. When a subscriber is attached, its return value replaces the default go_home response, so return a full envelope (status, process_normal, send_notifications, type, message, data, …).

⚠️ This filter passes a single $values array — not a GF $entry/$form pair. It fires inside mam-main’s own standard-form handler (gf_standard_form()) after the app-submitted values are collected, gated by has_filter(). It is the mam-main form pipeline’s post-collection hook, not a wrapper around Gravity Forms’ native gform_after_submission.


When this fires vs. siblings

App form submission dispatched
        │
        ▼
mam_gf_processing_form (action, dispatcher)
        │
        ▼
gf_standard_form( $form_id ):
    mam_gf_get_form_settings  → form definitions
    mam_gf_get_form_data      → $values (collected field values)
        │
        ▼
has_filter( 'mam_gravity_forms_after_form_processed_' . $form_id ) ?
   ├─ yes → mam_gravity_forms_after_form_processed_{form-id}($values)   ← THIS HOOK
   │           returns the response envelope
   └─ no  → default { status: success, type: go_home, ... }
        │
        ▼
JSON response to app

The mam_for_gravity_forms_form_submitted_{form-id} and ..._result_form_{form-id} hooks live in a separate handler (submit-app-form.php) — they are not part of this handler’s linear chain.


Example: shape the response for a form

add_filter( 'mam_gravity_forms_after_form_processed_42',
    function ( array $values ): array {

        // Read a submitted field value.
        $total = (float) ( $values['total'] ?? 0 );

        if ( $total > 1000 ) {
            // Fire a downstream side effect.
            $this->flag_high_value_submission( $values, $total );
        }

        // Return a full response envelope — it replaces the default go_home.
        return array(
            'status'             => 'success',
            'process_normal'     => false,
            'send_notifications' => true,
            'type'               => 'go_home',
            'message'            => 'Thanks!',
            'data'               => array( 'computed_total' => $total ),
        );
    }
);

When to use

Use mam_gravity_forms_after_form_processed_{form-id} when you need to:

  • Fully own the response for a specific form id (your return value replaces the default go_home envelope)
  • Read the collected $values and fire side effects, then hand back a response

Use mam_for_gravity_forms_form_submitted_{form-id} / mam_for_gravity_forms_form_result_form_{form-id} (both in the separate submit-app-form path) when your form flows through that handler instead — they receive $form_id, $post_id, $values and $form_id, $response respectively.


Gotchas

  • Your return value replaces the response. When attached, the filter’s return becomes the app response envelope — omit a key and you drop it. Return a complete envelope.
  • Only $values is passed — the collected app-form field values (via mam_gf_get_form_data), not a GF $entry/$form.
  • Gated by has_filter(). If no subscriber is attached for the form id, mam-main returns its default go_home response and this filter never runs.
  • Form id is in the filter name. Don’t dispatch on form id inside a generic name.
  • Hot path for popular forms.

  • Form submission lifecycle
  • Forms manager overview
  • Hook: mam_for_gravity_forms_formsubmitted{id}
  • Hook: mam_for_gravity_forms_form_resultform{id}
  • Hook: mam_form_manager_send_notifications

Metadata

Field Value
Article type Hook Reference
Plugin slug mam-main
Applies to plugin version 2.1.11+
Hook type filter (dynamic — {form-id} is the GF form id)
Audience PHP developer
Last verified 2026-05-02
Was this article helpful?
Contents

    Need Support?

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