Home › Forums › Ticket Products › Event Tickets Plus › Maybe I found an issue regarding Tribe__Tickets__Tickets::get_event_attendees( )
- This topic has 6 replies, 2 voices, and was last updated 6 years, 3 months ago by Rene Hansen.
-
AuthorPosts
-
December 20, 2017 at 11:34 am #1410148Rene HansenParticipant
Hello folks,
On behalf of my client Rene, I have a question.
Why is this working:
1) $attendees = Tribe__Tickets__Tickets::get_event_attendees( );And this is not working:
2) $attendees = Tribe__Tickets__Tickets::get_event_attendees( $event_id );I am afraid this is magic code because it doesn’t make sense. Can you verify it is safe to use line: 1?
Best regards Thomas Riis
December 21, 2017 at 4:18 pm #1411350BarryMemberHi Thomas,
That’s an interesting problem!
Why is this working:
1) $attendees = Tribe__Tickets__Tickets::get_event_attendees( );And this is not working:
2) $attendees = Tribe__Tickets__Tickets::get_event_attendees( $event_id );That’s pretty much exactly the opposite of what I would expect and I don’t experience the same thing: that method requires an event ID to be passed and if you call it without any parameters at all a fatal error will be thrown.
Could you perhaps share more of your code? Also, when you say that the second approach isn’t working (assuming $event_id is a valid event I’m not sure why it wouldn’t), what are you experiencing exactly?
Thanks!
December 22, 2017 at 12:17 am #1411443Rene HansenParticipantHi Barry,
Yup and it didn’t make sense to me, but when I created more users and they bought tickets. I could see that the call returned all attendees. That could actually be a use case. It was not what I needed so I added the event_id again and it worked.
Php Storm also complained about the line but no error was thrown. Not even in the error log.
My method is used for a shortcode:
public function handle_attendees_shortcode($att){ $output = ''; if (isset($att['id']) && class_exists('Tribe__Tickets__Tickets') && function_exists( 'tribe_tickets_get_attendees' ) ) { $attendees = Tribe__Tickets__Tickets::get_event_attendees( intval($att['id']) ); $output .= '<div class="row">'; $output .= '<div class="col-md-3"><h5>Deltagere / købere</h5></div>'; $output .= '</div>'; $output .= '<div class="row">'; $pid = 0; foreach ( $attendees as $attendant ) { //$output .= '<pre>' . print_r( $attendant ) . '</pre>'; $output .= '<div class="col-md-3">' . $attendant['purchaser_name'] . '<br>' . $attendant['purchaser_email'] . '</div>'; $eid = $attendant['event_id']; } $output .= '</div>'; } $output .= '<div class="riiso-attendees-list"> <form method="post"> </form> </div>'; return $output; }
The shortcode is called from: plugins/the-events-calendar-community-events/src/views/community/event-list.php (and I am using it as a template file – i have added shortcode and send event->ID to the shortcode.
Hope it makes sense.
Best regards Thomas
December 22, 2017 at 7:28 am #1411592BarryMemberHi Thomas! So I see you marked this as resolved — just to be clear, you’re all good here?
December 30, 2017 at 9:42 am #1415173Rene HansenParticipantYes Barry all good here : )
- This reply was modified 6 years, 3 months ago by Rene Hansen.
January 1, 2018 at 2:49 pm #1415699BarryMemberExcellent – I’ll go ahead and close this topic in that case (but, of course, feel free to open new topics as needed should you require assistance with anything else) 🙂
-
AuthorPosts
- The topic ‘Maybe I found an issue regarding Tribe__Tickets__Tickets::get_event_attendees( )’ is closed to new replies.