Skip to content

Instantly share code, notes, and snippets.

@Pebblo
Created February 8, 2018 14:29
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/5c829126cdc85ab942db3d880e84cc91 to your computer and use it in GitHub Desktop.
Save Pebblo/5c829126cdc85ab942db3d880e84cc91 to your computer and use it in GitHub Desktop.
<?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