Using Gravity Forms ‘gform_notification_enable_cc’ PHP filter

The gform_notification_enable_cc Gravity Forms PHP filter enables the display of a carbon copy (CC) field when creating a notification.

Usage

To apply the filter to all forms:

add_filter('gform_notification_enable_cc', 'your_function_name', 10, 3 );

To target a specific form, append the form id to the hook name (format: gform_notification_enable_cc_FORMID):

add_filter('gform_notification_enable_cc_21', 'your_function_name', 10, 3 );

To target a specific form and notification, append the form id and notification id to the hook name (format: gform_notification_enable_cc_FORMID_NOTIFICATIONID). Note: The notification id can be found in the browser URL as the value for “nid”:

add_filter('gform_notification_enable_cc_21_5ade0502ec70f', 'your_function_name', 10, 3 );

Parameters

  • $enable_cc (bool): Indicates if the CC field should be displayed.
  • $notification (Notifications Object): The current notification object.
  • $form (Form Object): The form object.

More information

See Gravity Forms Docs: gform_notification_enable_cc

Examples

Enable CC field for all forms

This code enables the CC field for all form notifications.

add_filter('gform_notification_enable_cc', 'enable_cc', 10, 3 );

function enable_cc( $enable, $notification, $form ){
    return true;
}

Enable CC field for a specific form

This code enables the CC field for notifications of form with ID 21.

add_filter('gform_notification_enable_cc_21', 'enable_cc_for_form_21', 10, 3 );

function enable_cc_for_form_21( $enable, $notification, $form ){
    return true;
}

Enable CC field for a specific form and notification

This code enables the CC field for notifications of form with ID 21 and notification ID 5ade0502ec70f.

add_filter('gform_notification_enable_cc_21_5ade0502ec70f', 'enable_cc_for_specific_notification', 10, 3 );

function enable_cc_for_specific_notification( $enable, $notification, $form ){
    return true;
}

Disable CC field for all forms

This code disables the CC field for all form notifications.

add_filter('gform_notification_enable_cc', 'disable_cc', 10, 3 );

function disable_cc( $enable, $notification, $form ){
    return false;
}

Disable CC field for a specific form

This code disables the CC field for notifications of form with ID 21.

add_filter('gform_notification_enable_cc_21', 'disable_cc_for_form_21', 10, 3 );

function disable_cc_for_form_21( $enable, $notification, $form ){
    return false;
}