gform_personal_data_identification_fields

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.