Hook: mam_contact_form_contact_processed

Signature

do_action( 'mam_contact_form_contact_processed', array $values, array $form_data );
Parameter Type Description
$values array The submitted form values, keyed by field slug. Each entry is itself an array with at least a value key.
$form_data array The full Gravity Forms form definition for the contact form, as returned by the mam_gf_get_form filter.

This action takes no return value.


Purpose

Fires after a contact form submission has been fully processed by the plugin — the per-administrator notification messages have been built and dispatched via mam_notification_send_message, and the confirmation response is about to be returned to the mobile app.

Use this hook to run side-effects: forward the submission to a CRM, log to an analytics service, create a task in a ticketing system, append to a webhook, etc.


When it fires

Inside mam_contact_form_manager::process_contact_form() (mam-contact-form.php), in this order:

  1. The submitting user is verified (anonymous submissions short-circuit before this point with an error response).
  2. Field definitions and form data are loaded.
  3. The Name, Email, and Phone values are normalized (e.g., the GF compound name field is collapsed into a single string, and missing values are backfilled from the user profile).
  4. One notification message is built per WordPress administrator (or per Reason mapping when configured).
  5. do_action( 'mam_notification_send_message', $messages ) dispatches the emails.
  6. The confirmation message is resolved from the form’s default GF confirmation, falling through to "Thank you for contacting us." if none is set.
  7. mam_contact_form_contact_processed fires here. ← your callback
  8. The response array is returned to the mobile app.

The action is the last extension point before the response is returned. Whatever you do here is on the request thread — see Gotchas for the implications.


Examples

Forward to a CRM

add_action( 'mam_contact_form_contact_processed', 'forward_contact_to_crm', 10, 2 );

function forward_contact_to_crm( $values, $form_data ) {
    wp_remote_post(
        'https://crm.example.com/api/leads',
        [
            'timeout' => 5,
            'headers' => [ 'Authorization' => 'Bearer ' . MY_CRM_TOKEN ],
            'body'    => wp_json_encode( [
                'name'    => $values['name']['value']    ?? '',
                'email'   => $values['email']['value']   ?? '',
                'phone'   => $values['phone']['value']   ?? '',
                'reason'  => $values['reason']['value']  ?? '',
                'message' => $values['description']['value'] ?? '',
            ] ),
        ]
    );
}

Log every submission to an analytics endpoint

add_action( 'mam_contact_form_contact_processed', 'log_contact_submission', 10, 2 );

function log_contact_submission( $values, $form_data ) {
    do_action(
        'my_analytics_event',
        'contact_form_submitted',
        [
            'reason'  => $values['reason']['value'] ?? null,
            'form_id' => $form_data['id'] ?? null,
            'user'    => mam_user_id(),
        ]
    );
}

Common uses

  • Forward submissions to a CRM or help-desk system
  • Log analytics events for inbound contacts
  • Create a follow-up task in a project management tool
  • Trigger a Slack or webhook notification beyond the Gravity Forms email

Gotchas

  • Two parameters, not zero. Earlier internal docs described this as a no-arg action. As of v2.1 it is fired with $values and $form_data. You must declare 2 as the accepted-args count to receive both.
  • Runs synchronously on the request thread. Slow callbacks (external API calls, DB writes) delay the mobile app’s response. Offload to a background queue (Action Scheduler, WP Cron) if the work takes more than ~200ms.
  • Fires once per submission, not per administrator. Even though the plugin sends one notification per admin, this action fires exactly once with the submission’s values.
  • Does not fire on rejected submissions. Anonymous users and missing-form-data error paths return before reaching this action.
  • $values shape mirrors Gravity Forms. Each entry is an array of [ 'value' => ... ], not a flat string. Always read $values['email']['value'], not $values['email'].
  • Don’t write back into $values. The action does not pass by reference and the response has already been built. Mutations are no-ops.
  • For form-only side effects, prefer gform_after_submission. That GF hook receives the entry and form objects directly and works for any submission of the underlying form (including web embeds). Use mam_contact_form_contact_processed only when you specifically want submissions arriving through the mobile contact form path.

Verification

This article was last verified against:

  • Plugin: mam-contact-form v2.1
  • Source: mam-contact-form/mam-contact-form.php (process_contact_form())

Re-verify whenever the parameter list of the action changes, the order of operations in process_contact_form() changes, or the action is moved out of that method.


  • Plugin: mam-contact-form
  • Hook: mam_gf_get_form_settings_fields_contact_form
  • Hook: mam_contact_form_populate_contact
  • Recipe: Enabling multiple contact reason types

Metadata

Field Value
Article type Hook Reference
Plugin slug mam-contact-form
Applies to plugin version 2.1+
Category Extending MAM Suite
Hook type action
Audience PHP developer
Applies to setup paths Default path AND Gravity Forms path
Last verified 2026-05-01
Contents

    Need Support?

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