bookmark_bordergform_leads_before_export

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 Object to be exported.

  • $form

    The current form.

  • $paging array

    The current paging for the export. Includes the following properties:

    • offset integer

      Increases by 1 with each “page” of entries the export has processed.

    • page_size integer

      Defaults to 200.

Examples

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

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 should be placed in the functions.php file of your active theme.

Source Code

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