gform_disable_resend_notification

Description

The gform_disable_resend_notification filter allows developers to prevent a notification email from being resent.

Usage

To use the gform_disable_resend_notification filter, add it to your code as follows:

add_filter( 'gform_disable_resend_notification', 'your_function_name', 10, 4 );

Parameters

ParameterTypeDescription
$abort_emailboolDetermines whether the notification email should be prevented from being sent. Return true to block the email, or false to allow it. Default is false.
$notificationarrayThe current notification object.
$formarrayThe current form object.
$leadarrayThe current entry object.

Examples

Prevent Resending a Specific Notification.

This example prevents a specific notification (e.g., notification ID “68beda29a1b3c”) from being resent.

add_filter( 'gform_disable_resend_notification', 'prevent_specific_notification_resend', 10, 4 );

function prevent_specific_notification_resend( $abort_email, $notification, $form, $lead ) {
    if ( $notification['id'] === '68beda29a1b3c' ) {
        return true; // Prevent this notification from being resent
    }
    return $abort_email; // Retain default behavior for other notifications
}

Block Resend Based on Form Submission Data.

This example prevents the notification email from being resent if a specific field (e.g., field ID 5) in the form submission contains a certain value (e.g., “No”).

add_filter( 'gform_disable_resend_notification', 'block_resend_based_on_field', 10, 4 );

function block_resend_based_on_field( $abort_email, $notification, $form, $lead ) {
    if ( rgar( $lead, '5' ) === 'No' ) {
        return true; // Prevent resending if field ID 5 has the value "No"
    }
    return $abort_email; // Retain default behavior otherwise
}

Placement

This code can be used in the functions.php file of the active theme, a custom functions plugin, a custom add-on, or with a code snippets plugin.

See also the PHP section in this article: Where Do I Put This Code?

Since

Gravity Forms 2.3

Source Code

This filter is located in gravityforms.php