Skip to content

Instantly share code, notes, and snippets.

@robertstaddon
Created September 10, 2019 00:57
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save robertstaddon/771013d0f134e4fe74d32e8737136e20 to your computer and use it in GitHub Desktop.
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
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