bookmark_bordergform_disable_notification

Description

Use this filter to disable admin and user notification emails

Usage

add_filter( 'gform_disable_notification', 'disable_notification', 10, 4 );

You can also specify this per form by adding the form id after the hook name.

add_filter( 'gform_disable_notification_6', 'disable_notification', 10, 4 );

Parameters

  • $is_disabled bool

    Variable to be filtered. Set it to true to disable notifications

  • $notification array

    Current Notification array

  • $form

    Current form.

  • $entry Entry Object

    Current Entry array

Examples

1. Disable ALL Notifications

This example disables admin and user notifications for all forms

add_filter( 'gform_disable_notification', 'disable_notification', 10, 4 );
function disable_notification( $is_disabled, $notification, $form, $entry ) {
    return true;
}

2. Update from gform_disable_user_notification

This example shows you how to update your code from the deprecated gform_disable_user_notification hook

add_filter( 'gform_disable_notification', 'disable_notification', 10, 4 );
function disable_notification( $is_disabled, $notification, $form, $entry ) {

    //There is no concept of user notifications anymore, so we will need to disable notifications based on other criteria such as name
    if ( $notification['name'] == 'User Notification' ) {
        return true;
    }

    return $is_disabled;
}

3. Update from gform_disable_admin_notification

This example shows you how to update your code from the deprecated gform_disable_admin_notification hook

add_filter( 'gform_disable_notification', 'disable_notification', 10, 4 );
function disable_notification( $is_disabled, $notification, $form, $entry ) {

    //There is no concept of admin notifications anymore, so we will need to disable notifications based on other criteria such as name
    if ( $notification['name'] == 'Admin Notification' ) {
        return true;
    }

    return $is_disabled;
}

Placement

This code should be placed in the functions.php file of your active theme.

Source Code

This filter is located in GFAPI::send_notifications() in includes/api.php