gform_entries_column_filter

Description

The gform_entries_column_filter filter allows developers to inject markup and replace the value of any non-first column in the entry list grid.

Usage

add_filter( 'gform_entries_column_filter', 'change_column_data', 10, 5 );

Parameters

ParameterTypeDescription
$valuestringCurrent value that will be displayed in this cell.
$form_idintegerID of the current form.
$field_idintegerID of the field that this column applies to.
$entryEntry ObjectCurrent entry object.
$query_stringstringCurrent page query string with search and pagination state.

Examples

Replace the column value.

This example replaces the value when the field id is 2 and the form id is 1. Note: This example assumes that field with ID 2 is NOT placed in the first column on the entry grid. This hook does not fire for the first column in the grid. Look at gform_entries_first_column to add content to the first column.

add_filter( 'gform_entries_column_filter', 'change_column_data', 10, 5 );
function change_column_data( $value, $form_id, $field_id, $entry, $query_string ) {
	//only change the data when form id is 1 and field id is 2
	if ( $form_id != 1 && $field_id != 2 ) {
		return $value;
	}
	return "newdata";
}

Display text next to the existing value.

This example displays text next to the existing value.

add_filter( 'gform_entries_column_filter', 'change_column_data', 10, 5 );
function change_column_data( $value, $form_id, $field_id, $entry, $query_string ) {
	//only change the data when form id is 1 and field id is 2
	if ( $form_id != 1 && $field_id != 2 ) {
		return $value;
	}
	return $value . " - newdata";
}

Placement

This code can be used in the functions.php file of the active theme, a custom functions plugin, a custom add-on, or with a code snippets plugin.

See also the PHP section in this article: Where Do I Put This Code?

Source Code

This hook is located in GFEntryList::leads_page() in entry_list.php.