Description
Allows entries to be changed before export is executed.
Usage
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
- $entries array
An array of entry objects to be exported - $form array
The current form object - $pagingarray
The current paging for the export. Includes the following properties:
Examples
This example demonstrates how to use this hook 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, $paging ) {
foreach( $entries as &$entry ) {
$user = new WP_User( $entry['created_by'] );
if ( ! $user->ID )
continue;
$entry['created_by'] = $user->get( 'display_name' );
}
return $entries;
}
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 filter is located in GFExport::start_export() in export.php.