gform_campfire_message

gform_campfire_message

DescriptionUsageParametersExamples1. All feeds2. Specific feedPlacementSource Code

Description
This filter is used to dynamically alter the message before it is sent to Campfire.
Usage
The following would apply to all feeds:
add_filter( 'gform_campfire_message', 'your_function_name', 10, 4 );

To target feeds for a specific form append the form id to the hook name. (format: gform_campfire_message_FORMID)
add_filter( 'gform_campfire_message_4', 'your_function_name', 10, 4 );

Parameters

$message string
The message to be sent to Campfire.

$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. All feeds
This example shows how you can change the message.
add_filter( 'gform_campfire_message', 'change_message', 10, 4 );
function change_message( $message, $feed, $entry, $form ) {

return 'your new message';
}

2. Specific feed
This example shows how you can change the message for a specific feed.
add_filter( 'gform_campfire_message_4', 'change_another_message', 10, 4 );
function change_another_message( $message, $feed, $entry, $form ) {
if ( rgars( $feed, 'meta/feedName' ) == 'Campfire Feed 2' ) {
$message = 'your new message';
}

return $message;
}

Placement
This code should be placed in the functions.php file of your active theme.
Source Code
gf_apply_filters( 'gform_campfire_message', $form['id'], rgars( $feed, 'meta/message' ), $feed, $entry, $form )

This filter is located in GFCampfire::process_feed() in class-gf-campfire.php.

gform_capsulecrm_case

gform_capsulecrm_case

DescriptionUsageParametersExamplesPlacementSinceSource Code

Description
This filter allows the Capsule CRM Case object to be modified before it is created.
Usage
The following would apply to all forms:
add_filter( 'gform_capsulecrm_case', 'your_function_name', 10, 4 );

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

To target a specific feed for a form, append the form id and feed id to the hook name. (format: gform_capsulecrm_case_FORMID_FEEDID)
add_filter( 'gform_capsulecrm_case_1_7', 'your_function_name', 10, 4 );

Parameters

$case array
Capsule CRM case.
array (
'name' => 'Capsule CRM',
'description' => 'Test Case',
'status' => 'OPEN',
'party' =>
array (
'id' => 179884585,
'owner' =>
array (
'username' => 'testuser'
)
)
)

$form Form Object
The current form.

$entry Entry Object
The current entry.

$feed Feed Object
The current feed.

Examples
add_filter( 'gform_capsulecrm_case', 'change_case_object', 10, 4 );
function change_case_object( $case, $form, $entry, $feed ){
$case['description'] = 'Created by API';
return $case;
}

Placement
This code should be placed in the functions.php file of your active theme.
Since
This filter was added in Gravity Forms Capsule CRM Add-On version 1.2.
Source Code
This filter is located in GFCapsuleCRM::create_case() in class-gf-capsulecrm.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_capsulecrm_opportunity

gform_capsulecrm_opportunity

DescriptionUsageParametersExamplesPlacementSinceSource Code

Description
This filter allows the Capsule CRM Opportunity object to be modified before it is created.
Usage
The following would apply to all forms:
add_filter( 'gform_capsulecrm_opportunity', 'your_function_name', 10, 4 );

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

To target a specific feed for a form, append the form id and feed id to the hook name. (format: gform_capsulecrm_opportunity_FORMID_FEEDID)
add_filter( 'gform_capsulecrm_opportunity_1_7', 'your_function_name', 10, 4 );

Parameters

$opportunity array
Capsule CRM opportunity.
array (
'name' => 'Capsule CRM',
'description' => 'Test Case',
'party' =>
array (
'id' => 179884585
),
'milestone' =>
array(
'name' => 'Meeting'
),
'owner' =>
array(
'username' => 'testuser'
)
)

$form Form Object
The current form.

$entry Entry Object
The current entry.

$feed Feed Object
The current feed.

Examples
add_filter( 'gform_capsulecrm_opportunity', 'change_opportunity_object', 10, 4 );
function change_opportunity_object( $opportunity, $form, $entry, $feed ){
$opportunity['description'] = 'Opportunity Created by API';
return $opportunity;
}

Placement
This code should be placed in the functions.php file of your active theme.
Since
This filter was added in Gravity Forms Capsule CRM Add-On version 1.2.
Source Code
This filter is located in GFCapsuleCRM::create_opportunity() in class-gf-capsulecrm.php.

gform_capsulecrm_person

gform_capsulecrm_person

DescriptionUsageParametersExamplesPlacementSinceSource Code

Description
This filter allows the Capsule CRM Person object to be modified before it is created/updated.
Usage
The following would apply to all forms:
1add_filter( 'gform_capsulecrm_person', 'your_function_name', 10, 4 );
To target a specific form, append the form id to the hook name. (format: gform_capsulecrm_person_FORMID)
1add_filter( 'gform_capsulecrm_person_1', 'your_function_name', 10, 4 );
To target a specific feed for a form, append the form id and feed id to the hook name. (format: gform_capsulecrm_person_FORMID_FEEDID)
1add_filter( 'gform_capsulecrm_person_1_7', 'your_function_name', 10, 4 );

Parameters

$person array
Capsule CRM person.
12345678910111213array (  'type' => 'person',  'firstName' => 'TestFirst',  'lastName' => 'TestLast',  'about' => "New Person created by API',  'jobTitle => '',  'emailAddress' =>     array (      array(        'address' => '[email protected]'      )    ))

$form Form Object
The current form.

$entry Entry Object
The current entry.

$feed Feed Object
The current feed.

Examples
12345add_filter( 'gform_capsulecrm_person', 'change_person_object', 10, 4 );function change_person_object( $person, $form, $entry, $feed ){    $person['about'] = 'Person Created by API';    return $person;}
Placement
This code should be placed in the functions.php file of your active theme.
Since
This filter was added in Gravity Forms Capsule CRM Add-On version 1.2.
Source Code
This filter is located in GFCapsuleCRM::create_person() in class-gf-capsulecrm.php.

gform_capsulecrm_task

gform_capsulecrm_task

DescriptionUsageParametersExamplesPlacementSinceSource Code

Description
This filter allows the Capsule CRM Task object to be modified before it is created.
Usage
The following would apply to all forms:
1add_filter( 'gform_capsulecrm_task', 'your_function_name', 10, 4 );
To target a specific form, append the form id to the hook name. (format: gform_capsulecrm_task_FORMID)
1add_filter( 'gform_capsulecrm_task_1', 'your_function_name', 10, 4 );
To target a specific feed for a form, append the form id and feed id to the hook name. (format: gform_capsulecrm_task_FORMID_FEEDID)
1add_filter( 'gform_capsulecrm_task_1_7', 'your_function_name', 10, 4 );

Parameters

$task array
Capsule CRM task.
12345678910111213141516array (  'description' => 'Capsule CRM',  'detail' => 'Task Created by API',  'lastName' => 'TestLast',  'dueOn' => '2019-02-14',  'dueTime => '21:25:08',  'status' => 'OPEN',  'category' =>       array(        'name' => 'Follow-up'      ),   'owner' =>      array(       'username' => 'testuser'     ))

$form Form Object
The current form.

$entry Entry Object
The current entry.

$feed Feed Object
The current feed.

Examples
12345add_filter( 'gform_capsulecrm_task', 'change_task_object', 10, 4 );function change_task_object( $task, $form, $entry, $feed ){    $task['description'] = 'Task Created by API';    return $task;}
Placement
This code should be placed in the functions.php file of your active theme.
Since
This filter was added in Gravity Forms Capsule CRM Add-On version 1.2.
Source Code
This filter is located in GFCapsuleCRM::create_task() in class-gf-capsulecrm.php.

gform_card_details

gform_card_details

DescriptionUsageParametersExamplesPlacementSinceSource Code

Description
This filter is executed when creating the Stripe Card or Square field and can be used to modify the 「Card Details」 label.
Usage
1add_filter( 'gform_card_details', 'change_details', 10, 2 );
Parameters

$label string
The label to be filtered.

$form_id integer
The current form』s id.

Examples
This example changes the default Card Details label:
1234add_filter( 'gform_card_details', 'change_details', 10, 2 );function change_details( $label, $form_id ) {    return "Credit Card Specifics";}
Placement
This code should be placed in the functions.php file of your active theme.
Since
This filter was added in Stripe 2.6 and Square 1.0.
Source Code
Stripe add-on: This filter is located in GF_Field_Stripe_CreditCard::get_form_editor_inline_script_on_page_render() in gravityformsstripe/includes/class-gf-field-stripe-creditcard.php
Square add-on: This filter is located in GF_Field_Square_CreditCard::get_form_editor_inline_script_on_page_render() in gravityformssquare/includes/class-gf-field-square-creditcard.php

gform_after_delete_form

gform_after_delete_form

DescriptionUsageParametersExamplesSource Code

Description
Use this action hook to perform actions right after a form is deleted.
Usage
1add_action( 'gform_after_delete_form', 'do_cleanup' );

Parameters

$form_id integer
ID of current form.

Examples
This example adds a log file entry when a form is deleted.
12345678add_action( 'gform_after_delete_form', 'log_form_deleted' );function log_form_deleted( $form_id ) {    $log_file = ABSPATH . '/gf_deleted_forms.log';    $f = fopen( $log_file, 'a' );    $user = wp_get_current_user();    fwrite( $f, date( 'c' ) . " - Form deleted by {$user->user_login}. Form ID: {$form_id}. n" );    fclose( $f );}
Source Code
This action hook is located in GFFormsModel::delete_form() in form_model.php.

gform_after_duplicate_form

gform_after_duplicate_form

DescriptionUsageParametersExamplesSource Code

Note: This hook has been deprecated and the hook gform_post_form_duplicated should be used instead.
Description
The 「gform_after_duplicate_form」 action in Gravity Forms is triggered after a form is duplicated, allowing further actions to be performed. The hook provides the ID of the form duplicated and the ID of the new form created.
Usage
add_action( 'gform_after_duplicate_form', 'my_function', 10, 2 );

Parameters

$form_id string
ID of the form being duplicated.

new_id string
ID of the new copy of the form.

Examples
function my_function($form_id, $new_id) {
echo 'Form ' . $form_id . ' was copied into ' . $new_id;
}
add_action( 'gform_after_duplicate_form', 'my_function', 10, 2 );

Source Code
This action hook is located in forms_model.php.

gform_after_email

gform_after_email

DescriptionUsageParametersExamples1. Retry sending2. Add note to entryPlacementSource Code

Description
Use this hook to perform actions after a user or admin notification has been sent.
Usage
1add_action( 'gform_after_email', 'after_email', 10, 12 );

Parameters

$is_success bool
Indicates whether the wp_mail function was able to successfully process the mail request without errors.

$to string
Email address to which the message is being sent.

$subject string
Email subject.

$message string
Email body.

$headers array
Email headers.

$attachments array
Email attachment(s).

$message_format string
Email format: text or html.

$from string
From email.

$from_name string
From name.

$bcc string
Bcc email.

$reply_to string
Reply to email.

$entry Entry Object
The entry currently being processed or false if not available.

Examples
1. Retry sending
This example tries to send the email a second time if the original request was unsuccessful.
12345678910add_action( 'gform_after_email', 'after_email', 10, 7 );function after_email( $is_success, $to, $subject, $message, $headers, $attachments, $message_format ) {    if ( ! $is_success ) {        //sending mail failed, try again one more time        $try_again = wp_mail( $to, $subject, $message, $headers, $attachments );        if ( ! $try_again ) {            //still unable to send, do something...perhaps log the failure in a text file        }    }}
2. Add note to entry
This example shows how you can add a note to the entry.
1234add_action( 'gform_after_email', function( $is_success, $to, $subject, $message, $headers, $attachments, $message_format, $from, $from_name, $bcc, $reply_to, $entry ) {    $current_user = wp_get_current_user();    RGFormsModel::add_note( $entry['id'], $current_user->ID, $current_user->display_name, 'the note to be added' );}, 10, 12 );
Placement
This code should be placed in the functions.php file of your active theme.
Source Code
This action hook is located in GFCommon::send_email() in common.php.