gform_list_item_pre_add

gform_list_item_pre_add

DescriptionUsageParametersExamples1. Reset Datepicker Input2. Set Column Input ValuePlacementSource Code

Description
This JavaScript hook can be used to filter new List Field rows before they are added.
Usage
1234gform.addFilter( 'gform_list_item_pre_add', function ( clone ) {    // do stuff    return clone;} );

Parameters

clone Javascript Object
The List Field table row.

group Javascript Object
The List Field table row before being cloned and the inputs cleared. Available from Gravity Forms 1.9.15.1.

Examples
1. Reset Datepicker Input
This example shows how you can reset a datepicker input so the datepicker will function on the new row.
1234567
2. Set Column Input Value
This example shows how you can set the value of the input in the second column of the new row.
123456
Placement
Your code snippet can be placed in a HTML field on your form or in a theme custom JavaScript file.
Source Code
This filter is located in js/gravityforms.js

gform_input_masks

gform_input_masks

DescriptionUsageParametersExamplesPlacementSource Code

Description
Use this filter to edit the list of built-in input masks that are displayed in the Text Field input mask setting. Useful when adding a new custom input mask that will be used repeatedly.
Usage
1add_filter( 'gform_input_masks', 'add_mask' );
Parameters

$masks array
Current list of masks to be filtered, in the following format:
123456789array(    'US Phone' => '(999) 999-9999',    'US Phone + Ext' => '(999) 999-9999? x99999',    'Date' => '99/99/9999',    'Tax ID' => '99-9999999',    'SSN' => '999-99-9999',    'Zip Code' => '99999',    'Full Zip Code' => '99999?-9999');

Examples
This example adds a new predefined mask for 「Product Key」.
12345add_filter( 'gform_input_masks', 'add_mask' );function add_mask( $masks ) {    $masks['Product Key'] = 'a*-999-a999';    return $masks;}
Placement
This code should be placed in the functions.php file of your active theme.
Source Code
This filter is located in GFFormsModel::get_input_masks() in forms_model.php.

gform_get_field_value

gform_get_field_value

DescriptionUsageParametersExamplePlacementSinceSource Code

Description
Filters the lead value.
Usage
add_filter( 'gform_get_field_value', 'your_function_name', 10, 3 );

Parameters

$value string
The value of the field.

$entry Entry Object
The current entry.

$field Field Object
The current field.

Example
add_filter( 'gform_get_field_value', 'change_field_value', 10, 3 );
function change_field_value( $value, $entry, $field ){
if ( $field['id'] == 1 ){
$value = 'Testing';
}
return $value;
}

Placement
This code should be placed in the functions.php file of your active theme.
Since
This filter was added in Gravity Forms version 1.5.
Source Code
This filter is located in:

GF_Entry_List_Table::column_default() in entry_list.php
GFFormsModel::get_lead_field_value() in forms_model.php

gform_helpscout_process_body_shortcodes

gform_helpscout_process_body_shortcodes

DescriptionUsageParametersExamples1. Enable for all forms2. Enable for a specific feed namePlacementSource CodeSince

Description
This filter can be used to enable shortcode processing in the Help Scout message body.
Usage
Applies to all forms:
add_filter( 'gform_helpscout_process_body_shortcodes', 'your_function_name', 10, 3 );

Applies to a specific form:
add_filter( 'gform_helpscout_process_body_shortcodes_4', 'your_function_name', 10, 3 );

Parameters

$process_shortcodes boolean
Is shortcode processing enabled? Default is false.

$form Form Object
The current form object.

$feed Feed Object
The current feed object.

Examples
1. Enable for all forms
This example shows how you can enable shortcode processing for all forms.
add_filter( 'gform_helpscout_process_body_shortcodes', '__return_true' );
2. Enable for a specific feed name
add_filter( 'gform_helpscout_process_body_shortcodes', function( $process_shortcodes, $form, $feed ) {

return rgars( $feed, 'meta/feed_name' ) == 'Help Scout Feed 1' ? true : $process_shortcodes;
}, 10, 3 );

Placement
This code should be placed in the functions.php file of your active theme.
Source Code
gf_apply_filters( 'gform_helpscout_process_body_shortcodes', $form['id'], false, $form, $feed )

This filter is located in GFHelpScout::process_feed() in class-gf-helpscout.php.
Since
This filter was added in Help Scout 1.1.1.

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_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

gform_helpscout_process_note_shortcodes

gform_helpscout_process_note_shortcodes

DescriptionUsageParametersExamplesPlacementSinceSource Code

Description
The 「gform_helpscout_process_note_shortcodes」 filter in the Help Scout Add-On for Gravity Forms indicates whether shortcodes should be processed in the notes.
Usage
The following would apply to all forms:
add_filter( 'gform_helpscout_process_note_shortcodes', 'your_function_name', 10, 3 );

To target a specific form, append the form id to the hook name. (format: gform_helpscout_process_note_shortcodes_FORMID)
add_filter( 'gform_helpscout_process_note_shortcodes_1', 'your_function_name', 10, 3 );

Parameters

$process_shortcodes bool
Indicates if notes should be processed for shortcodes.

$form Form Object
The form object.

$feed Feed Object
The feed object.

Examples
add_filter( 'gform_helpscout_process_note_shortcodes', 'process_note_sc', 10, 3 );
function process_note_sc( $process_shortcodes, $form, $feed ){
return false;
}

Placement
This code should be placed in the functions.php file of your active theme.
Since
This filter was added in Help Scout version 1.5.
Source Code
This filter is located in GFHelpScout::process_feed() in gravityformshelpscout/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_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_helpscout_tags

gform_helpscout_tags

DescriptionUsageParametersExamplesPlacementSource Code

Description
This filter is used to dynamically alter the tags being created for a Help Scout conversation.
Usage
Applies to all forms:
1add_filter( 'gform_helpscout_tags', 'your_function_name', 10, 4 );
Applies to a specific form:
1add_filter( 'gform_helpscout_tags_4', 'your_function_name', 10, 4 );
Parameters

$tags array
An array of tags to be assigned to the conversation.

$feed Feed Object
The current feed object.

$entry Entry Object
The current entry object.

$form Form Object
The current form object.

Examples
This example retrieves the license type a user has associated to their user meta and adds it as a tag.
123456789101112add_filter( 'gform_helpscout_tags', 'add_license_tag', 10, 4 );function add_license_tag( $tags, $feed, $entry, $form ) {     global $current_user;    get_currentuserinfo();     $license_type = get_user_meta( $current_user->ID, 'license_type', 'No License' );     $tags[] = $license_type;     return $tags;}
Placement
This code should be placed in the functions.php file of your active theme.
Source Code
1gf_apply_filters( 'gform_helpscout_tags', $form['id'], $tags, $feed, $entry, $form )
This filter is located in GFHelpScout::process_feed() in class-gf-helpscout.php.