gform_custom_merge_tags

gform_custom_merge_tags

DescriptionUsageParametersExamplePlacementSinceSource Code

Description
Allows for the inclusion of custom merge tags wherever merge tag drop downs are generated.
Usage
add_filter( 'gform_custom_merge_tags', 'your_function_name', 10, 4 );

Parameters

$merge_tags array
The merge tags.

$form_id int
The ID of the current form.

$fields Field Object
A collection of field objects.

$element_id int
The ID of the input field.

Example
add_filter('gform_custom_merge_tags', 'custom_merge_tags', 10, 4);
function custom_merge_tags( $merge_tags, $form_id, $fields, $element_id ) {
$merge_tags[] = array('label' => 'Download Link', 'tag' => '{download_link}');
return $merge_tags;
}

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.6.2.
Source Code
This filter is located in:
GFCommon::get_merge_tags() in common.php
GFCommon::insert_calculation_variables() in common.php

gform_disable_admin_notification

gform_disable_admin_notification

DescriptionUsageParametersExampleSource Code

Description
Use this filter to disable admin notification emails.

This hook has been deprecated. Please use gform_disable_notification instead.

Usage
1add_filter( 'gform_disable_admin_notification', 'disable_notification', 10, 3 );
You can also specify this per form by adding the form id after the hook name.
1add_filter( 'gform_disable_admin_notification_6', 'disable_notification', 10, 3 );

Parameters

$is_disabled bool
Variable to be filtered. Set it to true to disable admin notifications

$form Form Object
Current form.

$entry Entry Object
Current Entry array

Example
This example disables admin notification for all forms.
1234add_filter( 'gform_disable_admin_notification', 'disable_notification', 10, 3 );function disable_notification( $is_disabled, $form, $entry ) {    return true;}
Source Code
This filter is located in GFAPI::send_notifications() in includes/api.php

gform_creditcard_types

gform_creditcard_types

DescriptionUsageParametersExamplesPlacementSource Code

Description
Use this filter to change the default list of supported credit card types.
Usage
1add_filter( 'gform_creditcard_types', 'add_card_type' );
Parameters

$cards array
The card array to be filtered. It is defined as follows:
123456789101112131415161718192021222324252627282930313233343536373839404142434445$cards =array (    array (        'name' => 'American Express',        'slug' => 'amex',        'lengths' => '15',        'prefixes' => '34,37',        'checksum' => true    ),    array (        'name' => 'Discover',        'slug' => 'discover',        'lengths' => '16',        'prefixes' => '6011,622,64,65',        'checksum' => true    ),    array (        'name' => 'MasterCard',        'slug' => 'mastercard',        'lengths' => '16',        'prefixes' => '51,52,53,54,55',        'checksum' => true    ),    array (        'name' => 'Visa',        'slug' => 'visa',        'lengths' => '13,16',        'prefixes' => '4,417500,4917,4913,4508,4844',        'checksum' => true    ),    array (        'name' => 'JCB',        'slug' => 'jcb',        'lengths' => '16',        'prefixes' => '35',        'checksum' => true    ),    array (        'name' => 'Maestro',        'slug' => 'maestro',        'lengths' => '12,13,14,15,16,18,19',        'prefixes' => '5018,5020,5038,6304,6759,6761',        'checksum' => true    ));
Note: The lengths, prefixes and checksum properties are used for validation and card type detection. Lengths indicates the card number』s allowed number of digits, prefixes indicates the allowed starting digit sequence and checksum indicates if the card validation requires a checksum.

Examples
This example removes Maestro from the list of available credit cards.
12345add_filter( 'gform_creditcard_types', 'remove_maestro' );function remove_maestro( $cards ) {    unset( $cards[5] ); //removing Maestro from the list    return $cards;}
Placement
This code should be placed in the functions.php file of your active theme.
Source Code
This filter is located in GFCommon::get_card_types() in common.php.

gform_default_notification

gform_default_notification

DescriptionUsageParametersExamples

Description
Use this filter to disable the default admin notification automatically generated for new forms.
Usage
1add_filter( 'gform_default_notification', '__return_false' );
Parameters

$is_enabled bool
Passes true, return false to disable.

Examples
Here is the simplest way to use this hook:
Source Code
This filter is located in GFFormDetail::save_form_info() in form_detail.php

gform_counter_script

gform_counter_script

DescriptionUsageParametersExamplesPlacementSource Code

Description
Use this filter to change the initialization script for the textarea counter script. Can be used to specify different initialization parameters.
Usage
1add_filter( 'gform_counter_script', 'set_counter_script', 10, 5 );
You can also target a specific form by adding the form id after the hook name.
1add_filter( 'gform_counter_script_6', 'set_counter_script', 10, 5 );
Parameters

$script string
The script (including