gform_slack_process_message_shortcodes

gform_slack_process_message_shortcodes

DescriptionUsageParametersExamples1. Enable for all forms2. Enable for a specific feed namePlacementSinceSource Code

Description
This filter can be used to enable shortcode processing in the Slack message.
Usage
The following would apply to all forms:
add_filter( 'gform_slack_process_message_shortcodes', 'your_function_name', 10, 3 );

To target a specific form append the form id to the hook name. (Format: gform_slack_process_message_shortcodes_FORMID)
add_filter( 'gform_slack_process_message_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_slack_process_message_shortcodes', '__return_true' );
2. Enable for a specific feed name
add_filter( 'gform_slack_process_message_shortcodes', function( $process_shortcodes, $form, $feed ) {

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

Placement
This code should be placed in the functions.php file of your active theme.
Since
This filter was added in Slack 1.3.1.
Source Code
gf_apply_filters( 'gform_slack_process_message_shortcodes', $form['id'], false, $form, $feed )

This filter is located in GFSlack::process_feed() in class-gf-slack.php.

gform_slack_invite

gform_slack_invite

DescriptionUsageParametersExamplesPlacementSinceSource Code

Description
The 「gform_slack_invite」 filter in the Gravity Forms Slack Add-On allows the invite user parameters to be modified before the invite is sent to Slack. The Invite User option in the Feed Setup only appears if setup is done by an admin user.
Usage
The following would apply to all forms:
add_filter( 'gform_slack_invite', 'your_function_name', 10, 4 );

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

Parameters

$invite array
Invite parameters.

$feed Feed Object
The current feed object.

$entry Entry Object
The current entry object.

$form Form Object
The current form object.

Examples
add_filter( 'gform_slack_invite', 'change_invite', 10, 4 );
function change_invite( $invite, $feed, $entry, $form ){
$invite['team'] = 'rocketgenius';
return $invite;
}

Placement
This code should be placed in the functions.php file of your active theme.
Since
This filter was added in version 1.6.
Source Code
This filter is located in GFSlack::send_invite() in gravityformsslack/class-gf-slack.php.

gform_slack_icon

gform_slack_icon

DescriptionUsageParametersExamplesPlacementSinceSource Code

Description
This filter is used to dynamically change the icon being displayed with the message sent to Slack. The icon image size should be 48×48.
apply_filters( 'gform_slack_icon', $this->get_base_url() . '/images/icon.png', $feed, $entry, $form )

Usage
add_filter( 'gform_slack_icon', 'change_slack_icon', 10, 4 );

Parameters

$icon_url string
The current icon being used for the Slack message.

$feed Feed Object
The current feed object.

$entry Entry Object
The current entry object.

$form Form Object
The current form object.

Examples
This example changes the icon URL if the form ID is 4.
add_filter( 'gform_slack_icon', 'change_slack_icon', 10, 4 );
function change_slack_icon( $icon_url, $feed, $entry, $form ) {

if ( $form['id'] == 4 ) {
$icon_url = 'http://placehold.it/48';
}

return $icon_url;
}

Placement
This code should be placed in the functions.php file of your active theme.
Since
This filter was added in Slack 1.4.
Source Code
This filter is located in class-gf-slack.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_site_created

gform_site_created

DescriptionUsageParametersExamplesPlacementSource Code

Description
Fires after the site has been created. Only applicable to Network installs with the 「Create Site」 option enabled.
Usage
Applies to all forms.
1add_action( 'gform_site_created', 'your_function_name', 10, 5 );

Parameters

$site_id integer
The ID of the created site.

$user_id string
The ID of the registered user.

$entry Entry Object
The entry object from which the site was created.

$feed Feed Object
The Feed which is currently being processed.

$password string
The password associated with the user; either submitted by the user or sent via email from WordPress.

Examples
Here is an example where we use this hook to create a new welcome post on the newly created site.
1234567891011121314add_action( 'gform_site_created', 'create_welcome_post', 10, 5 );function create_welcome_post( $site_id, $user_id, $entry, $feed, $password ) {     $user = get_userdata( $user_id );     $post = array();    $post['post_title'] = 'Welcome to your new site!';    $post['post_content'] = "Hi {$user->first_name}, nWe just wanted to personally welcome you to your new site!";     switch_to_blog( $site_id );    wp_insert_post( $post );    restore_current_blog(); }
Placement
This code should be placed in the functions.php file of your active theme.
Source Code
1do_action( 'gform_site_created', $blog_id, $user_id, $entry, $feed, $password );
This filter is located in GF_User_Registration::create_site() in class-gf-user-registration.php.

gform_signature_url

gform_signature_url

DescriptionUsageParametersExamples1. Enable transparencyPlacementSinceSource Code

Description
The gform_signature_url filter allows the signature URL to be customized.
Usage
The base filter which would run for all forms would be used like so:
add_filter( 'gform_signature_url', 'your_function_name', 10, 4 );

You can also target all signature fields in a form by adding the form id after the hook name.
// The following declaration targets all fields in form 6
add_filter( 'gform_signature_url_6', 'your_function_name', 10, 4 );

You can also target a specific field by adding the form id and field id after the hook name.
// The following declaration targets field 1 in form 6
add_filter( 'gform_signature_url_6_1', 'your_function_name', 10, 4 );

Parameters

$url string
The signature URL.

$filename string
The signature filename excluding extension.

$form_id int
The ID of the form used to create the requested signature.

$field_id int
The ID of the field used to create the requested signature.

Examples
1. Enable transparency
add_filter( 'gform_signature_url', 'enable_signature_transparency', 10, 4 );
function enable_signature_transparency( $url, $file_name, $form_id, $field_id ){

return add_query_arg( 't', 1, $url );
}

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 version 4.0.
Source Code
This filter is located in GF_Signature_Image::get_url() in includes/class-gf-signature-image.php.

gform_signature_url_require_login

gform_signature_url_require_login

DescriptionUsageParametersExamples1. Require login for all forms2. Require login for specific form and fieldPlacementSinceSource Code

Description
The gform_signature_url_require_login filter can be used to require the user be logged in before the signature URL will allow access to the file.
Usage
The following would apply to all forms.
add_filter( 'gform_signature_url_require_login', 'your_function_name', 10, 3 );

Parameters

$require_login bool
Does the user need to be logged in to access the signature? Default false.

$form_id int
The ID of the form used to create the requested signature.

$field_id int
The ID of the field used to create the requested signature.

Examples
1. Require login for all forms
add_filter( 'gform_signature_url_require_login', '__return_true' );

2. Require login for specific form and field
add_filter( 'gform_signature_url_require_login', 'require_login_for_signatures', 10, 3 );
function require_login_for_signatures( $require_login, $form_id, $field_id ){

// Update values below to match your form and field id's
if ( $form_id == '97' && $field_id == '2' ) {

$require_login = true;

}

return $require_login;
}

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 version 4.0.
Source Code
This filter is located in GF_Signature_Image::maybe_require_login() in includes/class-gf-signature-image.php.

gform_signature_url_permission_granted

gform_signature_url_permission_granted

DescriptionUsageParametersExamplesRequire the user to have administrative capabilitiesPlacementSinceSource Code

Description
The gform_signature_url_permission_granted filter can be used to perform custom logic to determine if the signature URL will allow access to the file.
Usage
The following would apply to all forms.
add_filter( 'gform_signature_url_permission_granted', 'your_function_name', 10, 3 );

Parameters

$permission_granted bool
Does the user have permission to access the signature? Default is the result of the hash validation.

$form_id int
The ID of the form used to create the requested signature.

$field_id int
The ID of the field used to create the requested signature.

Examples
Require the user to have administrative capabilities
The following example shows how you can restrict access to only those users who have permission to activate plugins, but only when the hash has passed validation.
add_filter( 'gform_signature_url_permission_granted', function( $permission_granted, $form_id, $field_id ) {
return $permission_granted && current_user_can( 'activate_plugins' );
}, 10, 3 );

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 version 4.0.
Source Code
This filter is located in GF_Signature_Image::is_permission_granted() in includes/class-gf-signature-image.php.

gform_signature_show_in_all_fields

gform_signature_show_in_all_fields

DescriptionUsageParametersExamplesPlacementSinceSource Code

Description
The 「gform_signature_show_in_all_fields」 filter in the Gravity Forms Signature Add-On allows the inclusion of the signature image in the {all_fields} merge tag output to be toggled on/off.
Usage
1add_filter( 'gform_signature_show_in_all_fields', 'your_function_name', 10, 4 );

Parameters

$include_signature bool
The current value indicating whether the signature image should be included.

$field Field Object
The Field Object.

$options string
The merge tag modifiers. e.g. 「value,nohidden」 would be the modifiers for {all_fields:value,nohidden}.

$value
The value of the field currently being processed.

Examples
The example below turns off the inclusion of the signature image in the {all_fields} merge tag.
1add_filter( 'gform_signature_show_in_all_fields', '__return_false' );
Placement
This code should be placed in the functions.php file of your active theme.
Since
This filter was added in version 2.3.
Source Code
This filter is located in GFSignature::merge_tag_filter() in gravityformssignature/class-gf-signature.php.

gform_signature_init_options

gform_signature_init_options

DescriptionUsageParametersExamples1. Fix IE11 issue2. Different size for mobile3. Fix Admin Bar issue4. Enable forceMouseEvent5. Change background colorSincePlacementSource Code

Description

The gform_signature_init_options filter can be used to customize the SuperSignature initialization options.

Usage

The following would apply to all forms.

add_filter( 'gform_signature_init_options', 'your_function_name', 10, 2 );

Parameters

$init_options array
The options to be used when initializing SuperSignature for this field.
$init_options = array(
'Enabled' => true,
'SignObject' => $field_id,
'BackColor' => empty( $this->backgroundColor ) ? '#FFFFFF' : $this->backgroundColor,
'PenSize' => rgblank( $this->penSize ) ? '2' : $this->penSize,
'PenColor' => empty( $this->penColor ) ? '#000000' : $this->penColor,
'SignWidth' => rgblank( $this->boxWidth ) ? '300' : $this->boxWidth,
'SignHeight' => '180',
'BorderStyle' => empty( $this->borderStyle ) ? 'Dashed' : $this->borderStyle,
'BorderWidth' => rgblank( $this->borderWidth ) ? '2px' : $this->borderWidth . 'px',
'BorderColor' => empty( $this->borderColor ) ? '#DDDDDD' : $this->borderColor,
'RequiredPoints' => '15',
'ClearImage' => gf_signature()->get_base_url() . '/includes/super_signature/refresh.png',
'PenCursor' => gf_signature()->get_base_url() . '/includes/super_signature/pen.cur',
'Visible' => true,
'ErrorMessage' => '',
'StartMessage' => '',
'SuccessMessage' => '',
);

$field Field Object
The current field object.

$form Form Object
The current form object.

Examples

1. Fix IE11 issue

This example shows how you can fix an issue with IE11 which prevents the signature being captured.

add_filter( 'gform_signature_init_options', 'disable_iemodalfix' );
function disable_iemodalfix( $init_options ) {
$init_options['IeModalFix'] = false;

return $init_options;
}

2. Different size for mobile

This example shows how you can set a different width for the signature panel for mobile devices.

add_filter( 'gform_signature_init_options', 'mobile_signature_width' );
function mobile_signature_width( $init_options ) {
if ( wp_is_mobile() ) {
$init_options['SignWidth'] = 100;
}

return $init_options;
}

3. Fix Admin Bar issue

This example shows how you can fix an issue with the vertical offset of the signature when the admin bar is present on mobile devices.

add_filter( 'gform_signature_init_options', 'enable_iemodalfix' );
function enable_iemodalfix( $init_options ) {
$init_options['IeModalFix'] = true;

return $init_options;
}

4. Enable forceMouseEvent

This example shows how you can enable the forceMouseEvent setting which resolves an issue with some browsers and devices.

add_filter( 'gform_signature_init_options', 'enable_forceMouseEvent' );
function enable_forceMouseEvent( $init_options ) {
$init_options['forceMouseEvent'] = true;

return $init_options;
}

5. Change background color

This example shows how you can change the background color.

add_filter( 'gform_signature_init_options', 'change_BackColor' );
function change_BackColor( $init_options ) {
$init_options['BackColor'] = '#4091EA';

return $init_options;
}

Since

This filter was added in Gravity Forms Signature Add-On 3.0.2.

Placement

This code should be placed in the functions.php file of your active theme.

Source Code

This filter is located in GF_Field_Signature::get_supersignature_init_options() in class-gf-field-signature.php.