gform_helpscout_enable_bcc

gform_helpscout_enable_bcc

DescriptionUsageParametersPlacementSource Code

Description
This filter is used to enable the display of the BCC setting on the Help Scout feed.
Usage
add_filter( 'gform_helpscout_enable_bcc', '__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-helpscout.php.

gform_helpscout_conversation

gform_helpscout_conversation

DescriptionUsageParametersExamplesChange the conversation subjectAttach a file created from a Paragraph field valueAdd custom fieldPlacementSinceSource Code

Description
Filter the conversation before it is created in Help Scout.
Usage
The following would apply to all forms:
add_filter( 'gform_helpscout_conversation', 'your_function_name', 10, 4 );

To target a specific form, append the form id to the hook name. (format: gform_helpscout_conversation_FORMID)
add_filter( 'gform_helpscout_conversation_1', 'your_function_name', 10, 4 );

Parameters

$conversation array
Help Scout Conversation object.

$feed Feed Object
Current feed.

$entry Entry Object
Current entry.

$form Form Object
Current form.

Examples
Change the conversation subject
add_filter( 'gform_helpscout_conversation', 'change_conversation', 10, 4 );
function change_conversation( $conversation, $feed, $entry, $form ){
$conversation['subject'] = 'Test Subject';
return $conversation;

}

Attach a file created from a Paragraph field value
add_filter( 'gform_helpscout_conversation', function ( $conversation, $feed, $entry ) {
$report = rgar( $entry, '28' ); // Get the field value.

if ( ! empty( $report ) ) {
// Attach the file to the first thread which is located at index 0 in the array.
$conversation['threads'][0]['attachments'][] = array(
'fileName' => 'system-report.txt',
'mimeType' => 'text/plain',
'data' => base64_encode( $report ),
);
}

return $conversation;
}, 10, 3 );

Add custom field
The following example shows how Help Scout custom fields can be added to the conversation.
add_filter( 'gform_helpscout_conversation', function ( $conversation, $feed, $entry, $form ) {
$conversation['fields'][] = array(
'id' => 19680, // Custom field id from Help Scout.
'value' => gf_helpscout()->get_field_value( $form, $entry, '4' ), // Get value from form field ID 4.
);

return $conversation;
}, 10, 4 );

Placement
This code should be placed in the functions.php file of your active theme.
Since
This filter was added in the Gravity Forms HelpScout add-on version 1.6.
Source Code
This filter is located in GFHelpScout::process_feed() in class-gf-helpscout.php.

gform_has_admin_notices

gform_has_admin_notices

DescriptionUsageParametersExamplesEnable the noticeDisable the noticePlacementSinceSource Code

Description

The gform_has_admin_notices filter is used to determine whether or not to display the 「WordPress has new notifications.」 notice at the top of Gravity Forms admin pages.

Usage

The filter which runs on Gravity Forms admin pages would be used like so:

add_filter( 'gform_has_admin_notices', 'your_function_name' );

Parameters

$has_notices bool
Defaults to false; there are no notifications to display.

Examples

Enable the notice

add_filter( 'gform_has_admin_notices', '__return_true' );

Disable the notice

add_filter( 'gform_has_admin_notices', '__return_false' );

Placement

This code should be placed in the functions.php file of your active theme or a custom functions plugin.

Since

This filter was added in Gravity Forms v2.5.

Source Code

This filter is located in GCommon::notices_section() in common.php.

gform_gfuser_object_init

gform_gfuser_object_init

DescriptionUsageParametersExamplesSource Code

Removed: This hook was removed in version 3.0 with no replacement.

Description
Fires on the feed configuration page after the DOM has been loaded and the GFUser javascript object has been initialized.
Usage
1234567
Parameters
No parameters are passed to this event; however, it is useful to note that the GFUser object is a global namespace and properties can be safely added to it from this event.
Examples
This event is useful when wishing to add or modify values in the GFUser object. In the below example you can see how to add two values to the GFUser object and then call another function that process these new properties.
1234567891011
Source Code
This filter is located in userregistration.php.

gform_gf_field_create

gform_gf_field_create

DescriptionUsageParametersExamples1. Create GF_Field object based on 「type」 property (rather than 「inputType」 property)Source CodeSince

Description
Use this filter to modify or replace the GF_Field object after it has been created.
Usage
1add_filter( 'gform_gf_field_create', 'my_custom_function', 10, 2 );

Parameters

$field GF_Field
A GF_Field object of the type specified by the $properties['type'] or $properties['inputType'] properties.

$properties array
An array of field properties that will be used to generate the GF_Field object.

Examples
1. Create GF_Field object based on 「type」 property (rather than 「inputType」 property)
1234567add_filter( 'gform_gf_field_create', 'my_custom_function', 10, 2 );function my_custom_function( $field, $properties ) {    if( $field->type == 'myCustomFieldType' ) {        $field = new GF_My_Custom_Field_Type( $properties );    }    return $field;}
Source Code
This filter is located in GF_Fields::create() in includes/addon/class-gf-fields.php.
Since
This filter was added in Gravity Forms 2.0.

gform_getresponse_limit_pre_get_custom_fields

gform_getresponse_limit_pre_get_custom_fields

DescriptionUsageParametersExamplePlacementSinceSource Code

Description
The gform_getresponse_limit_pre_get_custom_fields allows the maximum number of custom fields which are retrieved from GetResponse to be overridden.
Usage
1add_filter( 'gform_getresponse_limit_pre_get_custom_fields', 'your_function_name' );
Parameters

$limit int
The custom fields limit. Defaults to 100.

Example
This example shows how you can modify the limit.
123add_filter( 'gform_getresponse_limit_pre_get_custom_fields', function ( $limit ) {    return 200;} );
Placement
This code should be placed in the functions.php file of your active theme or a custom functions plugin.
Since
This filter was added in GetResponse version 1.5.
Source Code
This filter is located in GFGetResponse::get_custom_fields_limit() in gravityformsgetresponse/class-gf-getresponse.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.

gform_getresponse_contact

gform_getresponse_contact

DescriptionUsageParametersExamplePlacementSinceSource Code

Description
This filter can be used to override the contact properties before they are passed to the GetResponse API.
Usage
The following would apply to all feeds:
add_filter( 'gform_getresponse_contact', 'your_function_name', 10, 5 );

To target feeds for a specific form append the form id to the filter name. (format: gform_getresponse_contact_FORMID)
add_filter( 'gform_getresponse_contact', 'your_function_name', 10, 5 );

Parameters

$contact array
The contact properties.

$existing_contact bool | array
False or the existing contact properties.

$feed Feed Object
The feed currently being processed.

$entry Entry Object
The entry currently being processed.

$form Form Object
The form currently being processed.

Example
This example shows how you can modify the contact properties to trigger autoresponders when a contact is added to a list.
add_filter( 'gform_getresponse_contact', function ( $contact ) {
$contact['dayOfCycle'] = 0;

return $contact;
} );

Placement
This code should be placed in the functions.php file of your active theme.
Since
This filter was added in GetResponse version 1.4.
Source Code
This filter is located in gravityformsgetresponse/class-gf-stripe.php.

gform_get_meta()

gform_get_meta()

DescriptionUsageParametersExamplesSource Code

Description
Retrieves the meta value of the specified meta key from the Entry Meta table.
Returns false if the meta key is not found.
Usage
$meta_value = gform_get_meta( $entry_id, $meta_key );

Parameters

$entry_id integer
The ID of the entry.

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

Examples
This example retrieves the referrer information stored in the entry meta and echos it to the screen.
function display_referrer( $entry_id ) {
$referrer = gform_get_meta( $entry_id, 'referrer' );
echo $referrer;
}

Source Code
This function is located in forms_model.php

gform_get_input_value

gform_get_input_value

DescriptionUsageParametersExamples1. Decode all values2. Decode values for a specific formPlacementSource CodeSince

Description
Use this filter to change the field』s value after being retrieved from the database. Use in conjunction with gform_save_field_value to perform low level transformations, such as encrypting/decrypting a field.
Usage
The base filter which would run for all forms and all fields would be used like so:
add_filter( 'gform_get_input_value', 'your_function_name', 10, 4 );

To target a specific form append the form id to the hook name. (format: gform_get_input_value_FORMID)
add_filter( 'gform_get_input_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_get_input_value_FORMID_FIELDID)
add_filter( 'gform_get_input_value_10_3', 'your_function_name', 10, 4 );

Parameters

$value string
Field value to be filtered.

$entry Entry Object
Current entry object.

$field Field Object
Current Field object.

$input_id float
For multi-input fields (i.e. name, address, checkboxes), this parameter will hold the input ID. For single input fields, this parameter will be blank.

Examples
1. Decode all values
This example assumes the field values were base 64 encoded, and decodes them so that they can be properly displayed. View gform_save_field_value for an example on how to encode the fields.
add_filter( 'gform_get_input_value', 'decode_field', 10, 4 );
function decrypt_field( $value, $entry, $field, $input_id ) {
return base64_decode( $value );
}

This example uses the GFCommon::decrypt() method.
add_filter( 'gform_get_input_value', 'decode_field', 10, 4 );
function decrypt_field( $value, $entry, $field, $input_id ) {
return GFCommon::decrypt( $value );
}

2. Decode values for a specific form
This is another example where you may select a specific form and specific fields to decode. It is also assumed that the values were base 64 encoded.
add_filter( 'gform_get_input_value', 'decode_field', 10, 4 );
function decode_field( $value, $entry, $field, $input_id ) {

//if not the form with fields to decode, just return the unaltered value without checking the fields
if ( absint( $entry['form_id'] ) <> 94 )
return $value;

//array of field ids to decode
$decode_fields = array( 1,2,3 );

//see if the current field id is in the array of fields to decode; decode if so, otherwise return unaltered value
if ( in_array( $field->id, $decode_fields ) ) {
return base64_decode( $value );
} else {
return $value;
}
}

Placement
This code should be placed in the functions.php file of your active theme.
Source Code
gf_apply_filters( 'gform_get_input_value', array( $field->formId, $field->id ), $val, $lead, $field, $input_id )

This filter is located in the following methods in forms_model.php

GFFormsModel::get_field_value_long()
GFFormsModel::build_lead_array()

Since
The base filter was added in Gravity Forms 1.5.2.1. The form and field specific versions were added in Gravity Forms 1.9.13.6