gform_updates_list

gform_updates_list

DescriptionUsageParametersExampleSincePlacementSource Code

Description
The 「gform_updates_list」 filters the available updates displayed on the Forms -> System Status -> Updates page.
Usage
Note: Set the run priority higher than the default of 10 because this filter is also added in the auto upgrade Gravity Forms code and the list of updates will not be complete unless the filter in the GF code runs before your added filter.
add_filter( 'gform_updates_list', 'your_function_name', 11, 1 );

Parameters

$updates array
An array of plugins displayed on the Updates page.

Example
This example removes a plugin from the list of available updates.
add_filter( 'gform_updates_list', 'remove_update', 11, 1 );

function remove_update( $updates ){
//remove user registration from the updates list
foreach( $updates as $id => $update ){
//loop through array and create ids for the sub arrays
//so the user registration plugin can be removed
if ( $update['slug'] == 'gravityformsuserregistration' ){
//remove it from the main array
unset( $updates[$id] );
break;
}
}

return $updates;
}

Since
This filter was added in v2.2.
Placement
This code should be placed in the functions.php file of your active theme.
Source Code
This filter is located in GF_Update::available_updates() in gravityforms/includes/system-status/class-gf-update.php.

gform_update_PROPERTY_NAME

gform_update_PROPERTY_NAME

DescriptionUsageParametersExamplesPlacementSource Code

Description
Use this action hook to perform logic when entries』 basic information is updated.
Usage
Specify the property name after the gform_update_ hook name:
1add_action( 'gform_update_status', 'status_changed', 10, 3 );

Parameters

$entry_id integer
Current entry ID.

$property_value Mixed
New value of the entry』s property.

$previous_value Mixed
Previous value of the entry』s property.

Examples
This example automatically deletes entries that are marked as Spam:
123456add_filter( 'gform_update_status', 'delete_spam', 10, 3 );function delete_spam( $entry_id, $property_value, $previous_value ) {    if ( $property_value == 'spam' ) {        GFAPI::delete_entry( $entry_id );    }}
This example sends an email to the admin whenever an entry』s status changes:
123456789add_action( 'gform_update_status', 'check_lead_status', 10, 3 );function check_lead_status( $entry_id, $property_value, $previous_value ) {    if ( $previous_value != $property_value ) {        $to = get_bloginfo( 'admin_email' );        $subject = "The status of entry {$entry_id} has changed.";        $message = "The status of entry {$entry_id} has changed. Please review this entry.";        wp_mail( $to, $subject, $message );    }}
This example sends an email to the admin whenever an entry is starred:
123456789add_action( 'gform_update_is_starred', 'check_starred_status', 10, 3 );function check_starred_status( $entry_id, $property_value, $previous_value ) {    if ( $previous_value != $property_value && $property_value == 1 ) {        $to = get_bloginfo( "admin_email" );        $subject = "Entry {$entry_id} has been starred as important.";        $message = "Entry {$entry_id} has been starred as important. Please review this entry.";        wp_mail( $to, $subject, $message );    }}
Placement
This code should be placed in the functions.php file of your active theme.
Source Code
This filter is located in GFFormsModel::update_lead_property() in forms_model.php.

gform_update_meta()

gform_update_meta()

DescriptionUsageParametersExamplesSource Code

Description
Updates the meta value of the specified meta key in the Entry Meta table. If the specified meta key does not exist, it will be created.
Usage
gform_update_meta( $entry_id, $meta_key, $meta_value );

Parameters

$entry_id integer
The ID of the entry.

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

$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. This parameter is optional (including it removes the need to perform an extra query, if passed when creating the metadata). If it is not included, the $form_id parameter is set to null.

Examples
This example sets a meta value for the returned confirmation value from a call to a fictional API on post submission.
add_action( 'gform_after_submission', 'send_to_api' );
function send_to_api( $entry ) {

// prepare entry details for third party API
$lead_details = array( 'id' => $entry['id'], 'first_name' => $entry[1], 'last_name' => $entry[2] );

// send to the third party API
$response = process_lead( $lead_details );

// add response value to entry meta
gform_update_meta( $entry['id'], 'api_response', $response );

}

Source Code
This function is located in forms_model.php

gform_twilio_set_to_phone_number

gform_twilio_set_to_phone_number

DescriptionUsageParametersExample1. Override all feeds2. Override specific feedPlacementSource Code

Description
This filter can be used to modify the TO number before the SMS is sent to Twilio.

This hook has been deprecated since Twilio version 2.4. Please use gform_twilio_message instead.

Usage
The filter which would run for all Twilio feeds can be used like so:
add_filter( 'gform_twilio_set_to_phone_number', 'your_function_name', 10, 3 );

Parameters

$to string
The number the SMS will be sent TO. Formatted with a 『+』 and country code e.g. +17571234567 (E.164 format).

$entry Entry Object
The Entry which is currently being processed.

$feed_id integer
The ID of the Feed Object which is currently being processed. Available since v2.1.

Example
1. Override all feeds
The following example shows how you can change the TO number for all Twilio feeds.
add_filter( 'gform_twilio_set_to_phone_number', 'change_to_number', 10, 2 );
function change_to_number( $to, $entry ) {
//grab phone number out of field 2, sample format "+17571234567"

return ! rgblank( $entry['2'] ) ? $entry['2'] : $to;
}

2. Override specific feed
The following example shows how you can change the TO number for a specific Twilio feed.
add_filter( 'gform_twilio_set_to_phone_number', function ( $to, $entry, $feed_id ) {
$feed = gf_twilio()->get_feed( $feed_id );

if ( rgars( $feed, 'meta/feedName' ) == 'your feed name' ) {
//grab phone number out of field 2, sample format "+17571234567"
return ! rgblank( $entry['2'] ) ? $entry['2'] : $to;
}

return $to;
}, 10, 3 );

Placement
Your code snippet should be placed in the functions.php file of your active theme.
Source Code
This filter is located in GFTwilio::send_sms() in class-gf-twilio.php.

gform_twilio_message

gform_twilio_message

DescriptionUsageParametersExamplesPlacementSinceSource Code

Description
The 「gform_twilio_message」 filter in the Gravity Forms Twilio Add-On is used to modify the SMS message arguments before it is sent.
Usage
The following would apply to all forms:
add_filter( 'gform_twilio_message', 'your_function_name', 10, 4 );

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

To target a specific form』s feed, append the form id and feed id to the hook name. (format: gform_twilio_message_FORMID_FEEDID)
add_filter( 'gform_twilio_message_1_1', 'your_function_name', 10, 4 );

Parameters

$args array
The arguments for the SMS message.
$args = { 'to' => '7571234567', 'from' => '7571112222', 'body' => 'This is a test.', 'shorten_url' => '1'};

$feed Feed Object
The Feed object.

$entry Entry Object
The Entry object.

$form Form Object
The Form object.

Examples
add_filter( 'gform_twilio_message', 'change_message', 10, 4 );
function change_message( $args, $feed, $entry, $form ){
$args['body'] = $args['body'] . ' - TEST!';
return $args;
}

Placement
This code should be placed in the functions.php file of your active theme.
Since
This filter was added in Twilio version 2.4.
Source Code
This filter is located in GFTwilio::process_feed() in gravityformstwilio/class-gf-twilio.php.

gform_trim_input_value

gform_trim_input_value

DescriptionUsageParametersExamplesPlacementSource Code

Description
Leading and trailing blank spaces are trimmed from all submitted form fields by default. Use this hook to disable that behavior so that the submitted values are left as is.
Usage
1add_filter( 'gform_trim_input_value', 'disable_trim', 10, 3 );

Parameters

$do_trim boolean
The value being filtered. True to trim the value of the current field. False to disable trimming.

$form_id integer
The ID of the current form

$field Field Object
The current field

Examples
The following example demonstrates how to disable trimming for a specific field of a form.
12345678add_filter( 'gform_trim_input_value', 'disable_trim', 10, 3 );function disable_trim( $do_trim, $form_id, $field ) {    if ( $form_id == 36 && $field->id == '1' ) {        return false;    }     return $do_trim;}
Placement
This code should be placed in the functions.php file of your active theme.
Source Code
This filter is located in the following methods in forms_model.php

GFFormsModel::maybe_trim_input()
GFFormsModel::trim_form_meta_values()
GFFormsModel::trim_conditional_logic_values_from_element()

gform_trigger_payment_delayed_feeds

gform_trigger_payment_delayed_feeds

DescriptionUsageParametersPlacementSinceSource Code

Description
An action hook which is primarily used in GFFeedAddOn by GFPaymentAddOn based add-ons to trigger processing of feeds delayed until payment is completed.
Usage
add_action( 'gform_trigger_payment_delayed_feeds', 'my_function", 10, 4 );

Parameters

$transaction_id string
The transaction or subscription ID.

$payment_feed array
The payment feed which originated the transaction.

$entry array
The entry currently being processed.

$form array
The form currently being processed.

Placement
This code should be placed in the functions.php file of your active theme.
Since
This filter was added in Gravity Forms 2.4.13.
Source Code
do_action( 'gform_trigger_payment_delayed_feeds', $transaction_id, $payment_feed, $entry, $form );
This filter is located in class-gf-payment-addon.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_trello_card

gform_trello_card

DescriptionUsageParametersExamples1. Override the card name2. Decode encoded characters in card descriptionPlacementSource Code

Description
This filter can be used to change the card properties before sending the data to Trello when using the Trello add-on.
Usage
The following would apply to all forms:
add_filter( 'gform_trello_card', 'your_function_name', 10, 4 );

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

Parameters

$card array
array(
'name' => 'New submission from feed add-on',
'desc' => 'Please add the ability to ....',
'labels' => 'green',
'idMembers' => 'TRELLO_MEMBER_ID_HERE',
'due' => '2016-10-01T00:00:00+00:00',
);

The card 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.

Examples
1. Override the card name
This example shows how you can override the card name.
add_filter( 'gform_trello_card_5', 'change_name', 10, 4 );
function change_name( $card, $feed, $entry, $form ) {
$card['name'] = 'Your new card name';

return $card
}

2. Decode encoded characters in card description
add_filter( 'gform_trello_card', function( $card ) {
$card['desc'] = htmlspecialchars_decode( $card['desc'], ENT_QUOTES );

return $card;
} );

Placement
This code should be placed in the functions.php file of your active theme.
Source Code
$card = gf_apply_filters( 'gform_trello_card', array( $form['id'] ), $card, $feed, $entry, $form );

This filter is located in GFTrello::process_feed() in class-gf-trello.php.