gform_polls_form_pre_results

gform_polls_form_pre_results

DescriptionUsageParametersExamplesPlacementSinceSource Code

Description
Allows the form object to be manipulated before the poll results are calculated for the front-end and entry detail pages.
Usage
The following would apply to all forms:
1add_filter( 'gform_polls_form_pre_results', 'your_function_name', 10, 1 );
To target a specific form, append the form id to the hook name. (format: gform_polls_form_pre_results_FORMID)
1add_filter( 'gform_polls_form_pre_results_2', 'your_function_name', 10, 1 );

Parameters

$form Form Object
The form.

Examples
12345add_filter( 'gform_polls_form_pre_results', 'change_poll_form', 10, 1 );function change_poll_form( $form ){    $form['title'] = 'Testing'; //change some data    return $form;}
Placement
This code should be placed in the functions.php file of your active theme.
Since
This filter was added in the Gravity Forms Polls Add-On version 1.4.
Source Code
This filter is located in GFPolls::gpoll_get_data() in gravityformspolls/class-gf-polls.php

gform_polls_cron

gform_polls_cron

DescriptionUsageParametersExamplesPlacementSource Code

Description
Allows further actions to be performed after the cron job that gathers poll results runs.
Usage
1add_action( 'gform_polls_cron', 'your_function_name' );
Parameters
There are no parameters.
Examples
1234add_action( 'gform_polls_cron', 'send_message_after_cron_runs' );function send_message_after_cron_runs(){    GFCommon::send_email( '[email protected]', '[email protected]','','','Polls Cron Job', 'The polls cron job has run.');}
Placement
This code should be placed in the functions.php file of your active theme.
Source Code
This filter is located in GFPolls::pre_init() in class-gf-polls.php

gform_polls_cron_schedule

gform_polls_cron_schedule

DescriptionUsageParametersExamplesPlacementSinceSource Code

Description
Allows the frequency of the cron job that calculates poll data to be modified. The default schedule is set to hourly to avoid heavy loads on the server.
The wp_cron job will take over the calculation of the results if 5 seconds is not long enough at the time of form submission/update.
Important: the Polls Add-On must be deactivated and reactivated in order to reschedule the task.
Usage
1add_filter( 'gform_polls_cron_schedule', 'your_function_name', 10, 1 );

Parameters

$schedules array
An array of the current schedules.

Examples
123456789add_filter( 'gform_polls_cron_schedule', 'gform_polls_cron_add_twice_hourly' );function gform_polls_cron_add_twice_hourly( $schedules ) {    // Adds twice hourly to the existing schedules.    $schedules['twicehourly'] = array(        'interval' => 1800, // number of seconds in the interval        'display' => 'Twice Hourly'    );    return $schedules;}
Placement
This code should be placed in the functions.php file of your active theme.
Since
This filter was added in the Gravity Forms Polls Add-On version 1.5.
Source Code
This filter is located in GFPolls::get_custom_cron_schedule() in class-gf-polls.php

gform_plupload_settings

gform_plupload_settings

DescriptionUsageParametersExamples1. Maximum File Size2. The uploader URLPlacementSource Code

Description
The filter gform_pluploads_settings allows the initialization settings (file size, file count, browse button, drag and drop, and more) for Plupload to be changed. Plupload is used when the allow multiple files option is enabled.
Usage
The following would apply to all forms.
1add_filter( 'gform_plupload_settings', 'your_function_name', 10, 3 );
To limit the scope of your function to a specific form, append the form id to the end of the hook name. (format: gform_plupload_settings_FORMID)
1add_filter( 'gform_plupload_settings_75', 'init_plupload_settings', 10, 3 );

Parameters

$settings array

An array of the current settings for Plupload.

$form_id integer

The ID of the form in use.

$field GF_Field_Fileupload

The field object.

Examples
1. Maximum File Size
12345add_filter( 'gform_plupload_settings', 'init_plupload_settings', 10, 3 );function init_plupload_settings( $settings, $form_id, $field ){    $settings['filters']['max_file_size'] = '100kb';    return $settings;}
2. The uploader URL
1234add_filter( 'gform_plupload_settings', function( $settings, $form_id, $field ){    $settings['url'] = trailingslashit( site_url() ) . '?gf_page=' . GFCommon::get_upload_page_slug();    return $settings;}, 10, 3 );
Placement
This code should be placed in the functions.php file of your active theme.
Source Code
This filter is located in GF_Field_FileUpload::get_field_input() in includes/fields/class-gf-field-fileupload.php.

gform_phone_formats

gform_phone_formats

DescriptionUsageParametersExamples1. Add a UK phone format for all forms2. Add a Spanish phone format for all formsPlacementSinceSource Code

Description
Can be used to add new formats to those listed within the Phone field.
Usage
The following would apply to all forms.
1add_filter( 'gform_phone_formats', 'your_function_name', 10, 2 );
To limit the scope of your function to a specific form, append the form id to the end of the hook name. (format: gform_phone_formats_FORMID)
1add_filter( 'gform_phone_formats_5', 'your_function_name', 10, 2 );

Parameters

$phone_formats array
The phone formats. The following shows the default declaration of this array.
1234567891011121314$phone_formats = array(        'standard'      => array(            'label'       => '(###) ###-####',            'mask'        => '(999) 999-9999',            'regex'       => '/^D?(d{3})D?D?(d{3})D?(d{4})$/',            'instruction' => '(###) ###-####',        ),        'international' => array(            'label'       => __( 'International', 'gravityforms' ),            'mask'        => false,            'regex'       => false,            'instruction' => false,        ),    );
Each phone format consists of four properties.

label string
The label which will be displayed for the choice in the Phone Format setting, on the fields properties tab, in the form editor.

mask string | boolean
The input mask to be applied to the input when the form is displayed or false if an input mask should not be used. See the Input Mask article for some usage examples.

regex string | boolean
The regular expression which should be used when validating the field value on submission or false if validation of the value should not be performed.

instruction string | boolean
The text you want to display beneath the field input if the value fails the validation performed using the above regex, (i.e. Phone format: (###) ###-####) or false if you don』t want to display the instruction.

$form_id integer
The ID of the current form.

Examples
1. Add a UK phone format for all forms
The following example adds a UK format, including validation regex. It does not enable an input mask and does not display any instruction text if the field fails validation.
1234567891011add_filter( 'gform_phone_formats', 'uk_phone_format' );function uk_phone_format( $phone_formats ) {    $phone_formats['uk'] = array(        'label'       => 'UK',        'mask'        => false,        'regex'       => '/^(((+44s?d{4}|(?0d{4})?)s?d{3}s?d{3})|((+44s?d{3}|(?0d{3})?)s?d{3}s?d{4})|((+44s?d{2}|(?0d{2})?)s?d{4}s?d{4}))(s?#(d{4}|d{3}))?$/',        'instruction' => false,    );     return $phone_formats;}
2. Add a Spanish phone format for all forms
The following example adds a Spanish format, including validation regex that will accept only Spanish numbers in local format (no international prefix). It does not enable an input mask and does not display any instruction text if the field fails validation.
1234567891011add_filter( 'gform_phone_formats', 'es_phone_format' );function es_phone_format( $phone_formats ) {    $phone_formats['es'] = array(        'label'       => 'Spain',        'mask'        => '999999999',        'regex'       => '/^[9|6|7|8][0-9]{8}$/',        'instruction' => 'Introduce los 9 dígitos sin guiones ni espacios.',    );     return $phone_formats;}
Placement
This code should be placed in the functions.php file of your active theme.
Since
This filter was added in Gravity Forms 2.0-beta-2.2.
Source Code
This filter is located in GF_Field_Phone::get_phone_formats() in includes/fields/class-gf-field-phone.php.

gform_personal_data

gform_personal_data

DescriptionUsageParametersExamplesPlacementSinceSource Code

Description
The 「gform_personal_data」 filter in Gravity Forms allows custom data exporter and erasers to be registered with WordPress so they are also run when WP data cleanup occurs.
This hook works with WordPress』s Export Personal Data and Erase Personal Data Tools.
Usage
add_filter( 'gform_personal_data', 'your_function_name', 10, 2 );

Parameters

$custom_items array
An array of the custom export/erase functions to be run. The items in the array display on the Personal Data Settings page for selection.

$form Form Object
The form object.

Examples
add_filter( 'gform_personal_data', 'filter_gform_personal_data', 10, 2 );
function filter_gform_personal_data( $items, $form ) {
$items['test'] = array(
'label' => 'A custom item',
'exporter_callback' => 'gf_custom_data_exporter',
'eraser_callback' => 'gf_custom_data_eraser',
);

return $items;
}

function gf_custom_data_exporter( $form, $entry ) {
$data = array(
'name' => 'My Custom Value',
'value' => 'ABC123',
);
return $data;
}

function gf_custom_data_eraser( $form, $entry ) {
// Delete or anonymize some data
}

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.
Source Code
This filter is located in GF_Personal_Data::get_custom_items() in gravityforms/includes/class-personal-data.php.

gform_personal_data_identification_fields

gform_personal_data_identification_fields

DescriptionUsageParametersExamplesPlacementSinceSource Code

Description
Allows the list of customer identification fields (in Personal Data settings) to be modified. When configuring the Exporting and Erasing Data setting on the Personal Data settings page, this list is displayed in a drop-down and allows an administrator to select one of the available fields to serve as a customer identifier when exporting and erasing customer data.
By default, all email fields are automatically added as identification fields. If you have any field in your form that holds a User ID value, you can use this hook to add those fields to the list.
These choices appear in the Identification Field drop down on the Personal Data settings page.
Usage
The following would apply to all forms:
add_filter( 'gform_personal_data_identification_fields', 'your_function_name', 10, 2 );

To target a specific form, append the form id to the hook name. (format: gform_personal_data_identification_fields_FORMID)
add_filter( 'gform_personal_data_identification_fields_1', 'your_function_name', 10, 2 );

Parameters

$identification_field_choices array
An associative array with the field id as the key and the field label as the value.

$form Form Object
The current form.

Examples
The example below adds the 「created_by」 field as a choice for the identification field.
add_filter( 'gform_personal_data_identification_fields', 'add_fields', 10, 2 );
function add_fields( $identification_field_choices, $form ){
$identification_field_choices['created_by'] = 'Created By';
return $identification_field_choices;
}

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.
Source Code
This filter is located in GF_Personal_Data::form_settings() in gravityforms/includes/class-personal-data.php.

gform_permission_granted_pre_download

gform_permission_granted_pre_download

DescriptionUsageParametersExamplesRequire the user to have administrative capabilitiesPlacementSinceSource Code

Description
By default the real location of an uploaded file is hidden. The download URL will be generated with a security token to prevent guessing or enumeration attacks to discover the location of other files. The gform_permission_granted_pre_download filter can be used to perform custom logic to determine if the download URL will allow access to the file.
Usage
The following would apply to all forms.
add_filter( 'gform_permission_granted_pre_download', 'your_function_name', 10, 3 );

Parameters

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

$form_id int
The ID of the form used to upload the requested file.

$field_id int
The ID of the field used to upload the requested file.

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_permission_granted_pre_download', 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 Gravity Forms 2.4.3.2.
Source Code
This filter is located in GF_Download::maybe_process() in includes/class-gf-download.php.

gform_paypalpaymentspro_verifypeer

gform_paypalpaymentspro_verifypeer

DescriptionUsageParametersExamplesSinceSource Code

Description
Allows peer verification to be bypassed.
Usage
add_filter( 'gform_paypalpaymentspro_verifypeer', 'your_function_name', 10, 1 );

Parameters

$is_enabled bool
Indicates if the CURLOPT_SSL_VERIFYPEER setting is enabled, which allows peer verification to be bypassed. True enables peer verification, false disables.

Examples
add_filter( 'gform_paypalpaymentspro_verifypeer', 'disable_verification', 10, 1 );
function disable_verification( $is_enabled ){
return false;
}

This code should be placed in the functions.php file of your active theme.
Since
This filter was added in Gravity Forms PayPal Payments Pro v 2.2.
Source Code
This filter is located in GFPayPalPaymentsPro::post_to_payflow() in class-gf-paypalpaymentspro.php.

gform_paypalpaymentspro_verifyhost

gform_paypalpaymentspro_verifyhost

DescriptionUsageParametersExamplesSinceSource Code

Description
Allows host verification to be bypassed.
Usage
1add_filter( 'gform_paypalpaymentspro_verifyhost', 'your_function_name', 10, 1 );

Parameters

$is_enabled bool
Indicates if the CURLOPT_SSL_VERIFYHOST setting is enabled, which allows host verification to be bypassed. True enables host verification, false disables.

Examples
1234add_filter( 'gform_paypalpaymentspro_verifyhost', 'disable_verification', 10, 1 );function disable_verification( $is_enabled ){    return false;}
This code should be placed in the functions.php file of your active theme.
Since
This filter was added in Gravity Forms PayPal Payments Pro v 2.2.
Source Code
This filter is located in GFPayPalPaymentsPro::post_to_payflow() in class-gf-paypalpaymentspro.php.