Skip to content

Instantly share code, notes, and snippets.

@joshfeck
Last active July 5, 2019 18:14
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 joshfeck/0bcb5aee9d7359e43426b923982bdca3 to your computer and use it in GitHub Desktop.
Save joshfeck/0bcb5aee9d7359e43426b923982bdca3 to your computer and use it in GitHub Desktop.
Add a column to the Event Espresso 4 Registrations CSV report. The added column will display the selected method of payment (even before payment is actually made)
<?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_chosen_payment_option',
10,
2
);
function espresso_add_chosen_payment_option( $reg_csv_array, $reg_row ) {
$selected_payment = '';
if ($reg_row['TransactionTable.TXN_ID']) {
$selected_payment_obj = EEM_Payment_Method::instance()->get_one_by_ID(
$reg_row['TransactionTable.PMD_ID']
);
if ($selected_payment_obj instanceof EE_Payment_Method) {
$selected_payment = $selected_payment_obj->get('PMD_name');
}
}
$reg_csv_array['Selected Payment option'] = $selected_payment;
return $reg_csv_array;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment