Skip to content

Instantly share code, notes, and snippets.

@nielsvr
Last active December 7, 2015 10:13
Show Gist options
  • Save nielsvr/63b0a06efa27909817a8 to your computer and use it in GitHub Desktop.
Save nielsvr/63b0a06efa27909817a8 to your computer and use it in GitHub Desktop.
Extend the CSV export option of The Events Calender https://nielsvr.com/2015/12/07/extending-the-events-calendar-attendees-csv/
<?php
add_filter('tribe_events_tickets_attendees_csv_items', 'filter_eea_csv_items', 10, 1);
function filter_eea_csv_items( $items ) {
$first = true;
foreach( $items AS $item_row => $item ) {
if( $first ) {
$items[$item_row]['billing_address'] = "Billing address";
$items[$item_row]['shipping_address'] = "Shipping address";
$items[$item_row]['user_skype'] = "Skype";
$items[$item_row]['user_birthdate'] = "Birthdate";
$items[$item_row]['user_diet'] = "Diet";
$items[$item_row]['user_room'] = "Room";
$first = false;
} else {
$order_id = $items[$item_row][0];
$order = new WC_Order($order_id);
$billing_company_position = get_post_meta( $order_id, "billing_company_position", true );
$billing_company_position = get_post_meta( $order_id, "billing_company_position", true );
$billing_address = $order->get_billing_address()."<br/>".$billing_company_position;
$shipping_address = $order->get_shipping_address();
$skype = get_post_meta( $order_id, "user_skype", true );
$birthdate = get_post_meta( $order_id, "user_birthdate", true );
$diet = get_post_meta( $order_id, "user_diet", true );
$room = get_post_meta( $order_id, "user_room", true );
$items[$item_row]['billing_address'] = $billing_address;
$items[$item_row]['shipping_address'] = $shipping_address;
$items[$item_row]['birthdate'] = $birthdate;
$items[$item_row]['diet'] = $diet;
$items[$item_row]['room'] = $room;
}
}
return $items;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment