Created
November 11, 2017 14:21
-
-
Save Twanneman/3b95f437d6f7cddd6097aa02246f3c24 to your computer and use it in GitHub Desktop.
GF disable notifications
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// disable notifications | |
function send_notification ( $event, $form, $lead ) { | |
$notifications = GFCommon::get_notifications_to_send( $event, $form, $lead ); | |
$notifications_to_send = array(); | |
//running through filters that disable form submission notifications | |
foreach ( $notifications as $notification ) { | |
if ( apply_filters( "gform_disable_notification_{$form['id']}", apply_filters( 'gform_disable_notification', false, $notification, $form, $lead ), $notification, $form, $lead ) ) { | |
//skip notifications if it has been disabled by a hook | |
continue; | |
} | |
$notifications_to_send[] = $notification['id']; | |
} | |
GFCommon::send_notifications( $notifications_to_send, $form, $lead, true, $event ); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment