Description
Enables users to change the email validation for the TO address on notification pages. Useful to allow merge tags or shortcodes to be added to the TO field.
Usage
1 | add_filter( 'gform_is_valid_notification_to' , 'validate_to_email' , 10, 4 ); |
Parameters
- $is_valid boolean
The value being filtered. True if the to email is valid. False otherwise. Gravity Forms performs the validation before executing this hook, so $is_valid will contain the result of that validation. To override Gravity Form’s validation, simply set the value of this variable to true or false and return it.
-
$to_type string
The type of “Send To” that is configured. The possible values are “email”, “field” and “routing”.
-
$to_email string
The email address configured. Only applies when type ($to_type) is set to “email”
-
$to_field string
The ID of the field selected to be used as the “Send To”. Only applies when type ($to_type) is set to “field”
Examples
The following example demostrates how to allow the merge tag {user:user_email} to be used for notificatons “Send To” email
1 2 3 4 5 6 7 8 9 | add_filter( 'gform_is_valid_notification_to' , 'validate_to_email' , 10, 4 ); function validate_to_email( $is_valid , $to_type , $to_email , $to_field ) { if ( $to_email == '{user:user_email}' ) { return true; } return $is_valid ; } |
Placement
This code should be placed in the functions.php file of your active theme.
Source Code
This filter is located in GFNotification::is_valid_notification_to() in notification.php