gform_post_export_entries

Description

Triggered after exporting entries from a form, allowing further actions to be performed.

Usage

add_action( 'gform_post_export_entries', 'my_function', 10, 5 );

Parameters

  • $form array

    The form object to get the entries from.

  • $start_date string

    The start date from where the entries exported will begin.

  • $end_date string

    The end date on which the entry export will stop.

  • $array array

    The field IDs from which entries are being exported.

  • $export_id string

    The unique ID for the export. Since version 2.4.6.

Examples

1. Basic usage

function my_function() {
    //Do something here
}
add_action( 'gform_post_export_entries', 'my_function', 10, 5 );

2. Append additional entries

The following shows how additional entries can be appended to the entry export when using Gravity Forms 2.4.6 or greater.

add_action( 'gform_post_export_entries', function ( $form, $start_date, $end_date, $fields, $export_id ) {
	$entries = array(); // Define or get the additional entries here.

	$lines   = '';

	foreach ( $entries as $entry ) {
		$lines .= GFExport::get_entry_export_line( $entry, $form, $fields, array(), ',' );
		$lines .= "\n";
	}

	if ( ! seems_utf8( $lines ) ) {
		$lines = utf8_encode( $lines );
	}

	GFExport::write_file( $lines, $export_id );
}, 10, 5 );

Since

This filter was added in Gravity Forms version 1.9.3.

Added the “export_id” parameter in version 2.4.6.

Source Code

This action hook is located in export.php.