The functions in this gist have been modes to the EE Snippet Library and are no longer maintained here.
Please use the function(s) available here: https://github.com/eventespresso/ee-code-snippet-library/blob/master/admin/registration-reports/
The functions in this gist have been modes to the EE Snippet Library and are no longer maintained here.
Please use the function(s) available here: https://github.com/eventespresso/ee-code-snippet-library/blob/master/admin/registration-reports/
<?php //Please do not add the opening PHP tag if you already have one. | |
add_filter( 'FHEE__EE_Export__report_registrations__reg_csv_array', 'tw_espresso_add_people_to_report', 10, 2); | |
function tw_espresso_add_people_to_report( $reg_csv_array, $reg_row ) { | |
//Setup the 'People' column even if emtpy. | |
$reg_csv_array['People'] = ''; | |
//Load the people add-on helper. | |
EE_Registry::instance()->load_helper( 'People_View' ); | |
$people_in_types = EEH_People_View::get_people_for_event($reg_row['Registration.EVT_ID']); | |
//Create an array to hold all of the peoples names. | |
$peoples_names = array(); | |
//Loops though all people types and pull the people assigned to them. | |
foreach( $people_in_types as $people_type => $people ) { | |
//Loop through each person assigned to a type. | |
foreach($people as $person ) { | |
//Check we have an EE_Person object. | |
if( $person instanceof EE_Person ) { | |
//Add the persons name and type to the peoples_names array | |
//This adds them to the CSV using the format - "{person_name}({person_type})" | |
$peoples_names[] = $person->full_name() . '(' . $people_type . ')'; | |
} | |
} | |
} | |
//If we have peoples name, implode the array and add it to the CSV. | |
if( !empty($peoples_names) ) { | |
$reg_csv_array['People'] = implode( ', ', $peoples_names); | |
} | |
return $reg_csv_array; | |
} |
<?php //Please do not add the opening PHP tag if you already have one. | |
add_filter( 'FHEE__EE_Export__report_registrations__reg_csv_array', 'tw_espresso_add_people_to_report', 10, 2); | |
function tw_espresso_add_people_to_report( $reg_csv_array, $reg_row ) { | |
//Setup the 'People' column even if emtpy. | |
$reg_csv_array['People'] = ''; | |
//Load the people add-on helper. | |
EE_Registry::instance()->load_helper( 'People_View' ); | |
$people = EEM_Person::instance()->get_people_for_event_and_type($reg_row['Registration.EVT_ID'], 3); | |
//Create an array to hold all of the peoples names. | |
$peoples_names = array(); | |
//Loop through each person assigned to a type. | |
foreach($people as $person ) { | |
//Check we have an EE_Person object. | |
if( $person instanceof EE_Person ) { | |
//Add the persons name and type to the peoples_names array | |
//This adds them to the CSV using the format - "{person_name}({person_type})" | |
$peoples_names[] = $person->full_name(); | |
} | |
} | |
//If we have peoples name, implode the array and add it to the CSV. | |
if( !empty($peoples_names) ) { | |
$reg_csv_array['People'] = implode( ', ', $peoples_names); | |
} | |
return $reg_csv_array; | |
} |