Last active
July 5, 2019 18:14
-
-
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)
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?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