Winter Solstice sale! 30% Off code: SOLSTICE24 Shop Now

ends midnight 12/21 PST

How to add additional fields to download attendees CSV file

Last Updated: April 29, 2019

Create a CSV column header

For every new field you will need to add a new header field eg. Field Name

add_filter('evotx_csv_headers', 'evotx_add_headers',10,2);
function evotx_add_headers($array, $EVENT){
	$array[] = 'Field Name';
	$array[] = 'Field Name 2';
	return $array;
}

 

Add CSV row value

Similar to the above column values, for each data row you will need to add a new value for the new column field you added.

add_filter('evotx_csv_row', 'evotx_add_row',10,4);
function evotx_add_row( $array, $tn, $td, $EVENT){
	$array['new_field_slug'] = $EVENT->ID;
	$array['new_field_2_slug'] = $EVENT->get_title();

	return $array;
}

How to get custom values

The second part of the code, pass on the value for each row of attendee. The function get variables $tn (ticket number), $td (ticket data array) and $EVENT (main event class) You can use those to create values for the new field you are adding to each attendee in the CSV file.

 

$td – the ticket data array holds an array of data for the ticket. You can use print_r($td) within the code to see what information is there and use correct associate path in the array to show those information.

eg. $td[‘oD’][‘ordered_date’] – will get you the date the ticket was ordered.

$td[‘oDD’][‘order_id’] – will give you order ID for the ticket.

Did this article help you?

Ready to setup your calendar?