Home › Forums › Ticket Products › Event Tickets Plus › Add new column to Attendee table
- This topic has 3 replies, 2 voices, and was last updated 9 years, 11 months ago by
George.
-
AuthorPosts
-
May 23, 2016 at 8:08 pm #1118062
Carol Stambaugh
ParticipantAfter reading through docs and the forum, this solution seems like what we’re looking for except that we’re using Easy Digital Downloads, https://theeventscalendar.com/support/forums/topic/wootickets-add-columns-to-attendees-list/
How can we find the value of a field in our ticket fieldset (ticket was created on an Event)?
Thanks!
AndreaMay 24, 2016 at 5:46 am #1118147George
ParticipantHey Betsy/Andrea,
Thank you for reaching out.
Showing data in a custom column is something that would require custom coding, which we are not able to help with. So you will have take the reins on this; tinker and research online to figure it out; and/or hire a professional to implement your customizations if you see fit.
To try and offer at least some useful advice here, though, I would recommend using the get_post_meta() WordPress function on attendee objects.
You can read more about that function here: https://developer.wordpress.org/reference/functions/get_post_meta/
Code like this should be a good start:
$meta_data = get_post_meta( $item['attendee_id'], Tribe__Tickets_Plus__Meta::META_KEY, true );Now, how do you get the attendee ID in the first place, as in the above code? There are many ways and it depends on your needs, and so you will have to determine this on your own or hire a professional to help.
I would recommend exploring existing code, though, first—just to see how the plugins themselves add data to columns and/or display data from individual ticket fieldset fields. That code above, for example, is from this file in Event Tickets Plus:
event-tickets-plus/src/Tribe/Meta/Export.phpAny file in the src/Tribe/Meta folder might be worth reading, in fact—that’s where most of the fieldset-related stuff happens.
I hope this all helps!
Best of luck with your custom coding.
— George
May 25, 2016 at 1:28 pm #1118859Carol Stambaugh
ParticipantThanks George! With your help we were able to accomplish what we needed. Here’s what worked for us in case it helps someone else:
add_filter( 'manage_tribe_events_page_tickets-attendees_columns', 'add_my_custom_attendee_column', 20 ); add_filter( 'tribe_events_tickets_attendees_table_column', 'populate_my_custom_attendee_column', 10, 3 ); function add_my_custom_attendee_column( $columns ) { $columns['custom_id'] = 'Attendee Name'; return $columns; } function populate_my_custom_attendee_column( $existing, $item, $column ) { if ( 'custom_id' !== $column ) return $existing; $meta_data = get_post_meta( $item['attendee_id'], Tribe__Tickets_Plus__Meta::META_KEY, true ); return esc_html( $meta_data['athletes-name'] ); }May 25, 2016 at 5:35 pm #1118935George
ParticipantAwesome! 😀
-
AuthorPosts
- The topic ‘Add new column to Attendee table’ is closed to new replies.
