INCLUDE EVENT ID in the CSV export

Home Forums Ticket Products Event Tickets Plus INCLUDE EVENT ID in the CSV export

Viewing 7 posts - 1 through 7 (of 7 total)
  • Author
    Posts
  • #1159747
    aldwyn
    Participant

    I 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.

    #1160140
    Andras
    Keymaster

    Hey 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:

    UID:[email protected]

    The first number (3151) is the event ID.

    Does this answer your question?

    Cheers,
    Andras

    #1160152
    aldwyn
    Participant

    Hi, 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 ?

    #1160357
    Andras
    Keymaster

    Could 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

    #1160686
    aldwyn
    Participant

    This reply is private.

    #1161187
    Andras
    Keymaster

    Hey 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,
    Andras

    #1170490
    Support Droid
    Keymaster

    Hey 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

Viewing 7 posts - 1 through 7 (of 7 total)
  • The topic ‘INCLUDE EVENT ID in the CSV export’ is closed to new replies.