Description
This action hook can be used to perform a custom action when an Add-On Framework based add-on experiences an error when processing a feed.
Short Slugs
The Gravity Forms Add-On Slugs article lists the short slugs for the available add-ons.
The following add-ons currently use this hook:
- Advanced Post Creation
- Agile CRM
- Aweber
- Breeze
- Campaign Monitor
- Campfire
- Capsule CRM
- CleverReach
- Constant Contact
- Dropbox
- EmailOctopus
- GetResponse
- Help Scout
- Highrise
- HubSpot
- iContact
- MailChimp
- Mailgun
- Postmark
- Slack
- Trello
- Twilio
- Webhooks
- Zoho CRM
Usage
The base hook which would run for all feeds and would be used like so:
add_action( 'gform_mailchimp_error', 'your_function_name', 10, 4 );
This runs the hook for the Agile CRM add-on:
add_action( 'gform_agilecrm_error', 'your_function_name', 10, 4 );
To target feeds for a specific form, append the form id to the hook name. (format: gform_{$SHORT_SLUG}_error_FORMID)
add_action( 'gform_mailchimp_error_10', 'your_function_name', 10, 4 );
Parameters
- $feed Feed Object
The feed currently being processed.
-
$entry Entry Object
The entry currently being processed.
-
$form Form Object
The form currently being processed.
-
$error string
The error message.
Examples
1. Mailchimp API Issue
This example shows how you can trigger the sending of a notification if the Mailchimp API could not be initialized. You can adapt this example for use with any other Add-On Framework based add-on replacing mailchimp with any other supported add-on slug.
add_action( 'gform_mailchimp_error', 'send_mailchimp_error_email', 10, 4 ); function send_mailchimp_error_email( $feed, $entry, $form, $error_message ) { GFAPI::send_notifications( $form, $entry, 'mailchimp_api_issue' ); }
The mailchimp_api_issue notification event would be added via the gform_notification_events filter.
Placement
This code should be placed in the functions.php file of your active theme.
Source Code
This hook is located in GFFeedAddOn::add_feed_error() in includes/addon/class-gf-feed-addon.php.
Since
This hook was added in Gravity Forms 1.9.11.9.