Created
September 10, 2019 00:57
-
-
Save robertstaddon/771013d0f134e4fe74d32e8737136e20 to your computer and use it in GitHub Desktop.
Fix Gravity PDF form submission delay when PDF is attached to notifications by using Gravity Forms Delayed Email 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
public function __construct() { | |
// Stop any PDFs from being immediately generated (require Gravity Forms Delayed Email Notifications) | |
add_filter( 'gfpdf_maybe_attach_to_notification', array( $this, 'require_delayed_notifications' ), 10, 5 ); | |
} | |
public function require_delayed_notifications( $attach, $notification, $settings, $entry, $form ) { | |
// Disable Gravity PDF attachment if the notification has a flag (__AFTER_DELAY_FLAG__) letting us know that this notification is supposed to wait until after the delay | |
if ( preg_match( '/__AFTER_DELAY_FLAG__/', $notification['subject'] ) ) { | |
return false; | |
} | |
return $attach; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment