Skip to content

Instantly share code, notes, and snippets.

@Pebblo
Created March 2, 2023 21:57
Show Gist options
  • Save Pebblo/6b6bbc34d4be4aa3fb33721e0172eb25 to your computer and use it in GitHub Desktop.
Save Pebblo/6b6bbc34d4be4aa3fb33721e0172eb25 to your computer and use it in GitHub Desktop.
<?php //Do not include the opening PHP tag if you already have one.
add_filter(
'FHEE__EventEspressoBatchRequest__JobHandlers__RegistrationsReport__reg_csv_array',
'tw_ee_csv_always_add_event_name',
20,
2
);
function tw_ee_csv_always_add_event_name(
array $csv_row,
$reg_row
) {
$event_model = EEM_Event::instance();
$reg = EEM_Registration::instance()->get_one_by_ID($reg_row['Registration.REG_ID']);
$event_name[esc_html__('Event', 'event_espresso')] = sprintf(
/* translators: 1: event name, 2: event ID */
esc_html__('%1$s (%2$s)', 'event_espresso'),
EEH_Export::prepare_value_from_db_for_display(
$event_model,
'EVT_name',
$reg->event_name()
),
$reg->event_ID()
);
$csv_row = EEH_Array::insert_into_array(
$csv_row,
$event_name,
'Registration ID',
false
);
return $csv_row;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment