Using Gravity Forms ‘gform_post_export_entries’ PHP action

The gform_post_export_entries action is 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.
  • $fields (array): The field IDs from which entries are being exported.
  • $export_id (string): The unique ID for the export. Since version 2.4.6.

More information

See Gravity Forms Docs: gform_post_export_entries

Examples

Basic Usage

Perform a custom action after exporting entries:

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

Append Additional Entries

Append additional entries 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);