The gform_is_delayed_pre_process_feed Gravity Forms PHP filter allows you to delay feed processing for Add-On Framework based add-ons.
Usage
add_filter('gform_is_delayed_pre_process_feed', 'your_function_name', 10, 4);
For targeting a specific form, append the form id to the hook name:
add_filter('gform_is_delayed_pre_process_feed_10', 'your_function_name', 10, 4);
Parameters
- $is_delayed (boolean) – Indicates if feed processing is delayed.
- $form (Form Object) – The form currently being processed.
- $entry (Entry Object) – The entry currently being processed.
- $slug (string) – The add-on slug, including the gravityforms prefix.
More information
See Gravity Forms Docs: gform_is_delayed_pre_process_feed
Examples
Delay Feeds For Most Add-Ons
Delay all feeds except those for the Stripe and Mailchimp Add-Ons:
add_filter('gform_is_delayed_pre_process_feed', 'maybe_delay_feeds', 10, 4); function maybe_delay_feeds($is_delayed, $form, $entry, $slug) { $not_delayed = array('gravityformsmailchimp', 'gravityformsstripe'); return !in_array($slug, $not_delayed); }
Skip User Registration For Logged In Users
Prevent the User Registration ‘create’ feed running if the user is logged in:
add_filter('gform_is_delayed_pre_process_feed', 'maybe_delay_feeds', 10, 4); function maybe_delay_feeds($is_delayed, $form, $entry, $slug) { if (is_user_logged_in() && $slug == 'gravityformsuserregistration') { return gf_user_registration()->has_feed_type('create', $form); } return $is_delayed; }
Delay AWeber Feeds Until After Notifications/Confirmations
Delay AWeber feed processing until the end of the submission process:
add_filter('gform_is_delayed_pre_process_feed', 'maybe_delay_aweber_feeds', 10, 4); function maybe_delay_aweber_feeds($is_delayed, $form, $entry, $slug) { if ($slug == 'gravityformsaweber') { $fulfilled = gform_get_meta($entry['id'], $slug . '_is_fulfilled'); $processed = gform_get_meta($entry['id'], 'processed_feeds'); return empty($fulfilled) && rgempty($slug, $processed); } return $is_delayed; }
Delay Mailchimp Feeds Until After User Registration
Delay Mailchimp feed processing if a user hasn’t been created from the entry:
add_filter('gform_is_delayed_pre_process_feed', 'maybe_delay_mailchimp_feeds', 10, 4); function maybe_delay_mailchimp_feeds($is_delayed, $form, $entry, $slug) { if ($slug == 'gravityformsmailchimp' && function_exists('gf_user_registration')) { $user_id = gf_user_registration()->get_user_by_entry_id($entry['id'], true); return rgblank($user_id); } return $is_delayed; }