-
-
Save Pebblo/5c829126cdc85ab942db3d880e84cc91 to your computer and use it in GitHub Desktop.
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 if you already have one | |
add_filter( 'FHEE__EE_Export__report_registrations__reg_csv_array', 'espresso_add_course_id_csv', 10, 2); | |
function espresso_add_course_id_csv( $reg_csv_array, $reg_row ) { | |
// get the event's ID | |
$event_id = $reg_row[ 'Registration.EVT_ID' ]; | |
//Create the empty 'Course ID' column in the CSV | |
$reg_csv_array[ 'Course ID' ] = ''; | |
// Pull the post mate value | |
$my_course_id = get_post_meta( $event_id, 'my_course_id', true ); | |
//Check $mv_course_id has a value | |
if ( $my_course_id != '' ) { | |
//We have a value, assign it to the empty column we just created. | |
$reg_csv_array[ 'Course ID' ] = $my_course_id; | |
} | |
//Return the CSV row | |
return $reg_csv_array; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment