gform_activecampaign_contact_pre_sync

gform_activecampaign_contact_pre_sync

DescriptionUsageParametersExamplesPlacementSource CodeSince

Description
The gform_activecampaign_contact_pre_sync filter can be used to override the contact properties before the contact_sync request is sent to the API.
Usage
The filter which would run for all ActiveCampaign feeds can be used like so:
add_filter( 'gform_activecampaign_contact_pre_sync', 'your_function_name', 10, 4 );

You can limit the scope of the filter to a single form by appending the form id on the end of the hook name like so:
add_filter( 'gform_activecampaign_contact_pre_sync_5', 'your_function_name', 10, 4 );

Parameters

$contact array
The contact properties. See the ActiveCampaign API documentation for the full list of accepted properties.

$entry Entry Object
The entry currently being processed.

$form Form Object
The form object the current entry was created from.

$feed Feed Object
The feed which is currently being processed.

Examples
This example shows how you can add the ip4 property to the array.
add_filter( 'gform_activecampaign_contact_pre_sync', function( $contact, $entry, $form, $feed ) {

$contact['ip4'] = rgar( $entry, 'ip' );

return $contact;
}, 10, 4 );

Placement
This code should be placed in the functions.php file of your active theme.
Source Code
$contact = apply_filters( 'gform_activecampaign_contact_pre_sync', $contact, $entry, $form, $feed );
$contact = apply_filters( 'gform_activecampaign_contact_pre_sync_' . $form['id'], $contact, $entry, $form, $feed );

This filter is located in GFActiveCampaign::process_feed() in class-gf-activecampaign.php.
Since
This filter was added in ActiveCampaign 1.3.5.

gform_addon_field_value

gform_addon_field_value

DescriptionUsageParametersExamples1. Change Value of Specific Field2. Use Choice Text Instead of ValuePlacementSource CodeSince

Description
This filter can be used to modify a value before it is sent to a third-party by one of the Add-On Framework based add-ons. If you want to filter the value for a specific add-on you can use gform_short_slug_field_value.
Usage
The base filter which would run for all forms and all fields would be used like so:
add_filter( 'gform_addon_field_value', 'your_function_name', 10, 5 );

To target a specific form append the form id to the hook name. (format: gform_addon_field_value_FORMID)
add_filter( 'gform_addon_field_value_10', 'your_function_name', 10, 5 );

To target a specific field append both the form id and the field id to the hook name. (format: gform_addon_field_value_FORMID_FIELDID)
add_filter( 'gform_addon_field_value_10_3', 'your_function_name', 10, 5 );

Parameters

$field_value string
The value to be modified.

$form Form Object
The form currently being processed.

$entry Entry Object
The entry currently being processed.

$field_id string
The id of the field currently being processed.

$slug string
The add-on slug, including the gravityforms prefix. See the Gravity Forms Add-On Slugs article for a list of possible slugs.

Examples
1. Change Value of Specific Field
This example shows how you can change the value of field 3 on form 10 before it is passed to any of the feed add-ons.
add_filter( 'gform_addon_field_value_10_3', function ( $field_value, $form, $entry, $field_id ) {

return 'your new value';
}, 10, 4 );

2. Use Choice Text Instead of Value
This example shows how you can replace the value of a choice based survey field with the choice text.
add_filter( 'gform_addon_field_value', 'gf_get_choice_text', 10, 5 );
function gf_get_choice_text( $field_value, $form, $entry, $field_id, $slug ) {
$field = RGFormsModel::get_field( $form, $field_id );

if ( is_object( $field ) && $field->type == 'survey' ) {
$field_value = $field->get_value_export( $entry, $field_id, true );
}

return $field_value;
}

Placement
This code should be placed in the functions.php file of your active theme.
Source Code
$field_value = gf_apply_filters( array( 'gform_addon_field_value', $form['id'], $field_id ), $field_value, $form, $entry, $field_id, $this->_slug );

This filter is located in GFAddOn::get_field_value() in includes/addon/class-gf-addon.php.
Since
This filter was added in Gravity Forms 1.9.15.12.

gform_add_meta()

gform_add_meta()

DescriptionUsageParametersExamplesSource Code

Description
The function 「gform_add_meta()」 adds the metadata associated with an entry in the Entry Meta table. The data will be serialized.
Usage
gform_add_meta( $entry_id, $meta_key, $meta_value, $form_id = null );

Parameters

$entry_id integer
The ID of the entry.

$meta_key string
The meta key of the meta value you wish to add.

$meta_value string
The value to be set as the new value for the specified meta key.

$form_id integer
The form ID of the entry. Optional (saves extra query if passed when creating the metadata).

Examples
This example inserts a value for a new meta key.
//inserts "This is test data" for the meta key "my_test_key" for entry id 14 for form id 1.
gform_add_meta(14, 'my_test_key', 'This is test data.', 1);

Source Code
This function is located in forms_model.php

gform_activecampaign_enable_tag_mapping

gform_activecampaign_enable_tag_mapping

DescriptionUsageParametersPlacementSource Code

Description
This filter is used to enable the display of the tags field in the Map Fields section of the ActiveCampaign feed.

This hook was removed in ActiveCampaign 1.2 when the tags mapping setting was removed and replaced by a tags text input with merge tag support.

Usage
add_filter( 'gform_activecampaign_enable_tag_mapping', '__return_true' );

Parameters
This hook has no parameters.
Placement
This code should be placed in the functions.php file of your active theme.
Source Code
This filter is located in class-gf-activecampaign.php.

gform_addon_navigation

gform_addon_navigation

DescriptionUsageParametersExamplesSource Code

Description
Use this filter to add a sub-menu item under the 「Forms」 menu.
Usage
1add_filter( 'gform_addon_navigation', 'add_menu_item' );
Parameters

$menu_items array
Current list of menu items to be filtered, in the following format:
123456array(    array(  "name" => "gf_campaignmonitor",        "label" => "Campaign Monitor",        "callback" => "campaignmonitor_page",        "permission" => "gravityforms_campaignmonitor"););

Examples
This example adds a new sub-menu item under 「Forms」.
12345add_filter( 'gform_addon_navigation', 'add_menu_item' );function add_menu_item( $menu_items ) {    $menu_items[] = array( "name" => "new_submenu_name", "label" => "New Submenu", "callback" => "submenu_handler", "permission" => "edit_posts" );    return $menu_items;}
Source Code
This filter is located in GFForms::create_menu() in gravityforms.php

gform_addnote_button

gform_addnote_button

DescriptionUsageParametersExamplesPlacementSource Code

Description
The 「gform_addnote_button」 filter in Gravity Forms allows modification of the HTML of the 「Add Note」 button for Entry Notes on the Entry Detail page.
Usage
1add_filter( 'gform_addnote_button', 'your_function_name', 10, 1 );

Parameters

$note_button string
The HTML for the 「Add Note」 Button.

Examples
12345add_filter( 'gform_addnote_button', 'change_button', 10, 1 );function change_button( $note_button ){    $note_button = '';    return $note_button;}
Placement
This code should be placed in the functions.php file of your active theme.
Source Code
This filter is located in GFEntryDetail::notes_grid() in entry_detail.php.

gform_{$SHORT_SLUG}_field_value

gform_{$SHORT_SLUG}_field_value

DescriptionShort Slug ValuesUsageParametersExamples1. ActiveCampaign – Use Choice Text Instead of Value2. ActiveCampaign – Replace Commas with Pipes3. Emma – Format Checkbox Field4. Help Scout – Change Value of Specific Field5. Zoho CRM – Format Date Field6. Zoho CRM – Format Checkbox FieldPlacementSinceSource Code

Description
This filter can be used to modify a value before it is sent to a third-party by one of the Add-On Framework based add-ons. If you want to filter the value for any add-on you can use gform_addon_field_value.
Short Slug Values
The Gravity Forms Add-On Slugs article lists the available short slugs to use with this hook:
The following add-ons listed in the slug article do not use the hook:

Gravity Forms CLI Add-On
Gravity Forms Debug Add-On
Gravity Forms Gutenberg Add-On

The Zapier Add-On implements its own version of the hook:

gform_zapier_field_value

Usage
The base filter which would run for all forms and all fields would be used like so:
1add_filter( 'gform_helpscout_field_value', 'your_function_name', 10, 4 );
To target a specific form append the form id to the hook name. (format: gform_{$SHORT_SLUG}_field_value_FORMID)
1add_filter( 'gform_helpscout_field_value_10', 'your_function_name', 10, 4 );
To target a specific field append both the form id and the field id to the hook name. (format: gform_{$SHORT_SLUG}_field_value_FORMID_FIELDID)
1add_filter( 'gform_helpscout_field_value_10_3', 'your_function_name', 10, 4 );

Parameters

$value string
The value to be modified.

$form Form Object
The form currently being processed.

$entry Entry Object
The entry currently being processed.

$field_id string
The ID of the field currently being processed.

Examples
1. ActiveCampaign – Use Choice Text Instead of Value
This example shows how you can replace the value of a choice based survey field with the choice text.
1234567891011add_filter( 'gform_activecampaign_field_value', 'gf_get_choice_text', 10, 4 );function gf_get_choice_text( $value, $form, $entry, $field_id ) {    gf_activecampaign()->log_debug( __METHOD__ . '(): running.' );    $field = GFAPI::get_field( $form, $field_id );     if ( is_object( $field ) && $field->type == 'survey' ) {        $value = $field->get_value_export( $entry, $field_id, true );        gf_activecampaign()->log_debug( __METHOD__ . '(): Value: ' . $value );    }    return $value;}
2. ActiveCampaign – Replace Commas with Pipes
This example shows how you can replace the commas used to separate checkbox or multi select choices with pipe characters.
123456789101112add_filter( 'gform_activecampaign_field_value', 'gf_replace_commas_with_pipes', 10, 4 );function gf_replace_commas_with_pipes( $value, $form, $entry, $field_id ) {    gf_activecampaign()->log_debug( __METHOD__ . '(): running.' );    $field = GFAPI::get_field( $form, $field_id );     if ( is_object( $field ) && ( $field->type == 'checkbox' || $field->type == 'multiselect' ) ) {        $value = str_replace( ', ', '||', $value );        gf_activecampaign()->log_debug( __METHOD__ . '(): Value: ' . $value );    }     return $value;}
3. Emma – Format Checkbox Field
This example shows how you can reformat the checkbox field value to be passed as an array instead of a string.
123456789add_filter( 'gform_emma_field_value', function ( $value, $form, $entry, $field_id ) {    $field = GFAPI::get_field( $form, $field_id );     if ( is_object( $field ) && $field->get_input_type() === 'checkbox' ) {        $value = explode( ', ', $value );    }     return $value;}, 10, 4 );
4. Help Scout – Change Value of Specific Field
This example shows how you can change the value of field 3 on form 10 before it is passed to Help Scout.
1234add_filter( 'gform_helpscout_field_value_10_3', function ( $value, $form, $entry, $field_id ) {     return 'your new value';}, 10, 4 );
5. Zoho CRM – Format Date Field
This example shows how you can reformat the entry date from yyyy-mm-dd to the format configured on the field.
123456789add_filter( 'gform_zohocrm_field_value', function ( $value, $form, $entry, $field_id ) {    $field = GFAPI::get_field( $form, $field_id );     if ( is_object( $field ) && $field->type == 'date' ) {        $value = GFCommon::date_display( $value, $field->dateFormat );    }     return $value;}, 10, 4 );
6. Zoho CRM – Format Checkbox Field
This example shows how you can reformat the checkbox field value to pass true or false instead of the choice. This snippet is not needed if you』re using version 1.8 of the add-on or newer.
1234567891011add_filter( 'gform_zohocrm_field_value', function ( $value, $form, $entry, $field_id ) {    gf_zohocrm()->log_debug( __METHOD__ . '(): Running...' );    $field = GFAPI::get_field( $form, $field_id );     if ( is_object( $field ) && $field->get_input_type() === 'checkbox' ) {        gf_zohocrm()->log_debug( __METHOD__ . '(): Checkbox value to true or false.' );        $value = $value ? 'true' : 'false';    }     return $value;}, 10, 4 );
Placement
This code should be placed in the functions.php file of your active theme.
Since
This filter was added in Gravity Forms 1.9.10.11.
Source Code
1234gf_apply_filters( "gform_{$slug}_field_value", array(    $form['id'],    $field_id), $field_value, $form, $entry, $field_id );
This filter is located in GFAddOn::maybe_override_field_value() in includes/addon/class-gf-addon.php.

gf_has_action

gf_has_action

DescriptionUsageParametersReturnsExamplesSinceSource Code

Description
Determines if a callback has been registered for the specified action.
Usage
gf_has_action( array( 'action_name', $modifier1 ) );

Parameters

$action array
Array containing the action tag as well as the possible modifiers.

$function_to_check bool|callable
The optional callback to check for.

Returns
Returns boolean for whether the hook has any callbacks registered or if a specific callback is registered.

Examples
$result = gf_has_action( array( 'gform_after_submission', $form_id ) );

$result = gf_has_action( array( 'gform_after_submission', $form_id ), 'the_function_name' );

Since
This function was added in Gravity Forms version 2.4.18.
Source Code
This action hook is located in gravityforms.php

GFCoupons

GFCoupons

gf_coupons()get_submitted_coupon_codes()get_coupons_by_codes()insert_feed()

GFCoupons is the class which houses the main functionality of the Gravity Forms Coupons Add-on, it extends the GFFeedAddOn class which is part of the add-on framework. Below are a few functions which you may find useful when working on your own custom code.
gf_coupons()
The gf_coupons() function is used to return an instance of the GFCoupons class.
get_submitted_coupon_codes()
Retrieves any submitted coupon codes from the entry object.
$coupon_codes = gf_coupons()->get_submitted_coupon_codes( $form, $entry );

$form Form Object
The form object currently being processed.

$entry Entry Object
The entry object currently being processed.

Returns array | boolean
An array of coupon codes or false if no codes were submitted.

get_coupons_by_codes()
Retrieves the properties for the specified coupon codes.
$coupons = gf_coupons()->get_coupons_by_codes( $codes, $form );

$codes string | array
The codes for the coupons to be retrieved.

$form Form Object
The form object currently being processed.

Returns array|boolean
An associative array with the coupon code as key to the array containing that coupons properties. False if no coupon feeds were found.

insert_feed()
The insert_feed() method can be used to add new coupons.
$feed_id = gf_coupons()->insert_feed( $form_id, $is_active, $meta );

$form_id integer
The ID of the form this coupon can be used with or 0 if it can be used with all forms.

$is_active boolean
Is this coupon active or inactive.

$meta Coupons Feed Meta
An associative array containing the properties which determine the type of coupon and discount available.

Returns integer
The ID of the new feed.

GF_RECAPTCHA_PRIVATE_KEY

GF_RECAPTCHA_PRIVATE_KEY

DescriptionUsagePlacement

Description
Automatically pre-populates the reCAPTCHA private key when a new site is created on your Multi-Site install.
Usage
define( 'GF_RECAPTCHA_PRIVATE_KEY', 'YOUR-KEY-HERE' );

Placement
This constant should be set in your wp-config.php. See the article Wp Config Options for more details.