Skip to content

Instantly share code, notes, and snippets.

@joshfeck
Last active July 5, 2019 18:15
Show Gist options
  • Save joshfeck/fe12aa10c1e8deef04607189b69636d3 to your computer and use it in GitHub Desktop.
Save joshfeck/fe12aa10c1e8deef04607189b69636d3 to your computer and use it in GitHub Desktop.
Adds a column to the registrations CSV in Event Espresso 4 to display the name of the event's venue
<?php
//* Please do NOT include the opening php tag, except of course if you're starting with a blank file
add_filter(
'FHEE__EventEspressoBatchRequest__JobHandlers__RegistrationsReport__reg_csv_array',
'espresso_add_venue_to_report',
10,
2
);
function espresso_add_venue_to_report( $reg_csv_array, $reg_row ) {
$event_id = $reg_row['Registration.EVT_ID'];
$event = EEM_Event::instance()->get_one_by_ID( $event_id );
if ( $event instanceof EE_Event ) {
$venue = $event->get_first_related( 'Venue' );
if ( $venue instanceof EE_Venue ) {
$venue_name = !empty( $venue ) ? $venue->name() : '';
$reg_csv_array['Venue'] = $venue_name;
}
}
return $reg_csv_array;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment