Skip to content

Instantly share code, notes, and snippets.

@Twanneman
Created November 11, 2017 14:21
Show Gist options
  • Save Twanneman/3b95f437d6f7cddd6097aa02246f3c24 to your computer and use it in GitHub Desktop.
Save Twanneman/3b95f437d6f7cddd6097aa02246f3c24 to your computer and use it in GitHub Desktop.
GF disable notifications
// 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