An extension for the Gravity Forms WordPress plugin., (*1)
This extension provides an admin interface that allows the user to create 'feeds' that will asynchronously submit data from a gravity form submission to a 3rd party URL., (*2)
It is designed to 'mock' form submissions by POST-ing the data as a url encoded form request. The admin interface also provides a section where key/value data can be provided to send along with the request - this is to mock the inclusion of data in hidden fields, which is pretty common for services such as salesforce. There is the added benefit of these values never being exposed to the front-end user as well., (*3)
A single gravity forms submission can post to multiple external services by having multiple feeds, each of which can have it's own settings, selection of values to send etc, (*4)
Manual WordPress plugin install - ensure gravity forms is installed and active on your WordPress site - download the latest release as a zip - install the plugin using the WordPress admin - activate and configure the feeds, (*5)
Note: You will not recieve any updates as they are released when installing via this method, (*6)
WordPress install via Github Updater - This plugin has the correct headers to be installed via Andy Fragen's wonderful Github Updater Plugin - Follow the Github Updater instructions to install - When new tagged releases are published, the Github Updater plugin will allow you to upgrade via the normal process in wp-admin, (*7)
composer require framecreative/gravityforms-form-integrator
Pat yourself on the back for being a PHP developer not stuck in 2006 :nail_care:, (*8)
After activation there will be a new item in the settings menu called 'Form Integrator' , (*9)
Create a feed and you will be presented with the main settings page, (*10)
Conditionals, (*11)
Only one conditional field per feed is supported (for now), (*12)
Dynamic Fields, (*13)
Everything is sent as a URL encoded HTTP POST so it's possible to talk to non-form based endpoints that accept args via a query string, (*14)
Extra Data, (*15)
Be sure that you're posting to a secure endpoint (via https) before including and sensitive data, keep in mind it's all send in clear text, (*16)
, (*17)
The plugin will exhibit some extra behaviour is a constant names WP_ENV
is defined, (*18)
WP_ENV
is defined, and NOT live
or production
then each feed will dump its values on screen for debug on submit in addition to sending the request
if WP_ENV
is defined, and IS live
or production
then the feeds will utilise asynchronous processing - this drastically speeds things up for the end user experience, (*19)
In order to utilise the Async feed processing features you must define a WP_ENV
constant, and the value must be either live
or production
, (*20)
A single form can have multiple feeds to submit to multiple external services, or multiple conditional feeds etc, (*21)
Feeds can be disabled while keeping their settings intact - useful if they're not ready for primetime or the feed is seasonal, (*22)
, (*23)
Cloning Feeds across forms, (*24)
There isn't currently any copy/clone feed action, so if you need to configure a single external service to work across many forms it can get a bit tedious, (*25)
Each feed's settings are stored in a single row in the %%Your DB Prefix%%_gf_addon_feed
table, it's pretty easy to duplicate the rows and just change the form_id
value to match a different form., (*26)
The feed settings are all JSON, so you can edit them without having to worry about PHP Serialized data woes, (*27)
The plugin has 2 main filters - these allow you to manipulate the data before it is submitted to the external service, (*28)
Example use case: converting Gravity Forms checkbox or multi-select fields into a format salesforce will understand, (*29)
````php <?php, (*30)
add_filter('gf_form_integrator_modify_dynamic_field_value', 'myFormIntegratorFilter', 10, 7);, (*31)
// This filter is applied to each dynamic field map pairing before it's added to the array function myFormIntegratorFilter( $fieldValue, $fieldName, $fieldObject, $formIntegratorObject, $gf_feedArray, $gf_entryArray, $gf_formArray ){ // Do Stuff here return $fieldValue; };, (*32)
// Even though filters technically shouldn't cause side effects, you can add additional items to the array via // $formIntegratorObject->_postDataValues['my_extra_key'] = 'my_extra_value', (*33)
// return false to prevent this value from being added to the 'postDataValues' array ````, (*34)
There is also a filter called just before all the values are sent, containing the array of all data to be sent in the POST request, (*35)
````php <?php, (*36)
add_filter('gf_form_integrator_modify_values_pre_submit', 'myFormIntegratorArrayFilter', 10, 4);, (*37)
// This filter is applied once right before the POST request is made function myFormIntegratorFilter( $arrayOfData, $gf_feedArray, $gf_entryArray, $gf_formArray ){ // Do Stuff here return $arrayOfData; };, (*38)
// return false to prevent the submission of ALL VALUES to the service (cancel the whole thing) // use with caution, implement logging in your filter if you are going to short circuit things (add a note or something), (*39)
````, (*40)
Do your validation using Gravity Forms - the feed only gets processed for valid submissions, (*41)
If you are submitting to Pardot, be aware that you need to configure a SEPERATE feed for Salesforce web2lead., (*42)
Pardot passes these values on after submission using some heaps hacky JS, as we're making this request programatically there's no browser to run this JS!, (*43)