Skip to content

Instantly share code, notes, and snippets.

@Pebblo
Last active December 2, 2020 15:39
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Pebblo/09081bb43fa217b0e83060d151d3eda2 to your computer and use it in GitHub Desktop.
Save Pebblo/09081bb43fa217b0e83060d151d3eda2 to your computer and use it in GitHub Desktop.
Example of how to include the event categories within the registrations csv output.
<?php //Please do not add the opening PHP tag if you already have one.
function ee_tw_event_categories_to_csv( $reg_csv_array, $reg_row ) {
$EVT_ID = $reg_row['Registration.EVT_ID'];
$terms = array();
$event_categories = get_the_terms( $EVT_ID, 'espresso_event_categories' );
if ( $event_categories ) {
foreach( $event_categories as $term ) {
$terms[] = $term->name;
}
$terms = implode( ', ', $terms);
}
$reg_csv_array['Event Categories'] = !empty($terms) ? $terms : null;
return $reg_csv_array;
}
add_filter( 'FHEE__EventEspressoBatchRequest__JobHandlers__RegistrationsReport__reg_csv_array', 'ee_tw_event_categories_to_csv', 10, 2 );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment