Maybe I found an issue regarding Tribe__Tickets__Tickets::get_event_attendees( )

Home Forums Ticket Products Event Tickets Plus Maybe I found an issue regarding Tribe__Tickets__Tickets::get_event_attendees( )

Viewing 6 posts - 1 through 6 (of 6 total)
  • Author
    Posts
  • #1410148
    Rene Hansen
    Participant

    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

    #1411350
    Barry
    Member

    Hi 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!

    #1411443
    Rene Hansen
    Participant

    Hi 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

    #1411592
    Barry
    Member

    Hi Thomas! So I see you marked this as resolved — just to be clear, you’re all good here?

    #1415173
    Rene Hansen
    Participant

    Yes Barry all good here : )

    • This reply was modified 6 years, 3 months ago by Rene Hansen.
    #1415699
    Barry
    Member

    Excellent – 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) 🙂

Viewing 6 posts - 1 through 6 (of 6 total)
  • The topic ‘Maybe I found an issue regarding Tribe__Tickets__Tickets::get_event_attendees( )’ is closed to new replies.