Support

Home Forums Event Espresso Premium Custom registrations csv report

Custom registrations csv report

Posted: May 4, 2018 at 2:27 pm


bhesketh

May 4, 2018 at 2:27 pm

Hi

I’m trying to create custom csv report by modifying an existing one.

This code is suggested in multiple places of this forum, but I have problems adding new columns to it. It shows only those 3 columns. What’s the correct syntax for adding new columns, including custom columns e.g. data from user’s profile.

add_filter( ‘FHEE__EE_Export__report_registrations__reg_csv_array’, ‘espresso_reg_report_filter_columns’, 10, 2);
function espresso_reg_report_filter_columns( $csv_row, $registration_db_row ) {
$filtered_csv_row = array_intersect_key(
$csv_row,
array_flip(
array(
__( ‘First Name[ATT_fname]’, ‘event_espresso’ ),
__( ‘Last Name[ATT_lname]’, ‘event_espresso’ ),
__( ‘Email Address[ATT_email]’, ‘event_espresso’ ),
‘radio’,
//custom question’s admin label, doesn’t need to be translated. note though: if you ever change the custom question’s admin label, this code will need to be adjusted
)
)
);

return $filtered_csv_row;
}


Josh

  • Support Staff

May 4, 2018 at 2:34 pm

Hi,
Here’s and example that shows the correct syntax for adding new columns:

https://github.com/eventespresso/ee-code-snippet-library/blob/master/admin/registration_report_add_price_modifiers.php


bhesketh

May 7, 2018 at 11:13 am

Thank you. It helped.

Here is the simplified version of the code

// add first name to csv report
add_filter( ‘FHEE__EE_Export__report_registrations__reg_csv_array’, ‘espresso_add_fname’, 10, 2);

function espresso_add_fname( $reg_csv_array, $reg_row ) {
$reg_csv_array[ __( ‘First Name’, ‘event_espresso’ ) ] = $reg_row[‘Attendee_Meta.ATT_fname’];
return $reg_csv_array;
}


Tony

  • Support Staff

May 8, 2018 at 3:28 am

Hi there,

The above snippet adds the Attendee first name to the CSV report, but it already has that data anyway?

If you can provide more details on what you are trying to do we may be able to help you further.

You must be logged in to reply to this support post. Sign In or Register for an Account

Support forum for Event Espresso 3 and Event Espresso 4.
Documentation for EE3 and EE4
Documentation for Event Espresso 3

Documentation for Event Espresso 4

Status: publish

Updated by  Tony 1 week, 6 days ago ago

Topic Tags

Notifications

This topic is: not resolved
Do NOT follow this link or you will be banned from the site!