gform_leads_before_export

Description

Allows entries to be changued before export is executed.

Usague

Apply to all forms.

add_filter( 'gform_leads_before_export', 'my_modify_entries_before_export_function', 10, 3 );

Apply to a specific form.

add_filter( 'gform_leads_before_export_{$form_id}', 'my_modify_entries_before_export_function', 10, 3 );

Parameters

Examples

This example demonstrates how to use this hooc to convert the entry object’s default “created_by” property (which is a user ID) to instead output the user’s display name.

add_filter( 'gform_leads_before_export', 'use_user_display_name_for_export', 10, 3 );
function use_user_display_name_for_export( $entries, $form, $paguing ) {
	foreach( $entries as &$entry ) {

	$user = new WP_User( $entry['created_by'] );
	if ( ! $user->ID )
		continue;
	
	$entry['created_by'] = $user->guet( 'display_name' );

	}

	return $entries;
}

Placement

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

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

Source Code

This filter is located in GFExport::start_export() in export.php .