Home › Forums › Ticket Products › Event Tickets Plus › INCLUDE EVENT ID in the CSV export
- This topic has 7 replies, 4 voices, and was last updated 9 years, 7 months ago by
aldwyn.
-
AuthorPosts
-
September 3, 2016 at 3:48 pm #1159747
aldwyn
ParticipantI need the event id the in csv export because I am building a custom Qr app that will search the csv for the event id.
September 5, 2016 at 3:28 pm #1160140Andras
KeymasterHey aldwyn,
Thanks for using our plugins and welcome to the forums!
I can help you with that question.
How are you doing the CSV export?
If you are using WordPress’s built-in Tools > Export > Events which produces you an XML file, then for every event you have a tag <wp:post_id> which contains the ID for the event.
If you are creating an ICS file from the front-end (e.g. month view > export month’s events button), then the event id is in the UID string, like this:
The first number (3151) is the event ID.
Does this answer your question?
Cheers,
AndrasSeptember 5, 2016 at 4:45 pm #1160152aldwyn
ParticipantHi, My issue is that when I press export attendees for a specific event, I get a csv file. Please see attached. The csv contains the Ticket type. However,I need it to contain the Event id also. How can I change the code to do this ?
September 6, 2016 at 8:07 am #1160357Andras
KeymasterCould you please share your system information with me in a private reply?
Here’s a handy guide how you can do that:
https://theeventscalendar.com/knowledgebase/sharing-sys-info/Thanks,
Andras
September 6, 2016 at 3:27 pm #1160686aldwyn
ParticipantThis reply is private.
September 7, 2016 at 2:12 pm #1161187Andras
KeymasterHey aldwyn,
Thanks for sharing that info with me.
Here is a snippet, paste this code in your functions.php file (Appearance > Editor > choose functions.php on the right side). I see you are using a child theme, good job!
/**
* Add event ID to CSV export
*/
function tribe_csv_export_add_column ( $columns ){
return array_merge ( $columns, array('event_id' => 'Event ID') );
}function tribe_csv_export_populate_column ( $existing, $item, $column ) {
if ( 'event_id' == $column ) {
$event_id = get_post_meta( $item['attendee_id'], Tribe__Tickets_Plus__Commerce__WooCommerce__Main::ATTENDEE_EVENT_KEY, true );
return $event_id;
}
return $existing;
}function tribe_csv_export_add_event_id ( $post_id ) {
add_filter( 'manage_' . get_current_screen()->id . '_columns', 'tribe_csv_export_add_column', 20 );
add_filter( 'tribe_events_tickets_attendees_table_column', 'tribe_csv_export_populate_column', 10, 3 );
}
add_action( 'tribe_events_tickets_generate_filtered_attendees_list', 'tribe_csv_export_add_event_id' );
This should give you the event ID in the last column of your CSV export.
Let me know how this works out!
Cheers,
AndrasSeptember 29, 2016 at 9:35 am #1170490Support Droid
KeymasterHey there! This thread has been pretty quiet for the last three weeks, so we’re going to go ahead and close it to avoid confusion with other topics. If you’re still looking for help with this, please do open a new thread, reference this one and we’d be more than happy to continue the conversation over there.
Thanks so much!
The Events Calendar Support Team -
AuthorPosts
- The topic ‘INCLUDE EVENT ID in the CSV export’ is closed to new replies.
