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.

The support post ‘Custom registrations csv report’ is closed to new replies.

Have a question about this support post? Create a new support post in our support forums and include a link to this existing support post so we can help you.

Event Espresso