So I see the [ESPRESSO_EVENT_ATTENDEES] shortcode to list attendees. Along with this I need to show the answer from a custom question. Is there a way to do this?
Thanks for getting back to me on this. So I’ve been digging in the code trying to figure out how to get to the data and not having a lot of luck. I can probably build some queries to pull it from the DB faster than I can figure out how to use the existing objects… If anyone there has the time to take a quick look and help point me in the right direction I’d be happy to try and build it and create a pull request once I have it working.
So you likely already know the question ID (QST_ID) for the row you want to query from _esp_answer table to get the answer value (ANS_value). Is that about right?
I can see where you’d run into issues when using the shortcode because the [ESPRESSO_EVENT_ATTENDEES] shortcode is pulling data from the Contact/Attendee instead of the actual registration. Mostly because a contact/Attendee can have multiple registrations, so even if you get all the related registrations for that contact and loop through them, how do you know which registration ID is the right one?
With the above in mind, I guess I’d advise to not use the ESPRESSO_EVENT_ATTENDEES shortcode and instead do a query on the registrations for that event or ticket, then you’ll have the correct registration ID every time. Along with that, once you have the registration object, you can use the answer_value_to_question() method from the EE_Registration class.
Update: There is now a quick start guide that shows how you can add answers to custom question fields to the attendee list in our documentation.
Viewing 4 reply threads
The support post ‘List attendees with aneser to custom questions’ is closed to new replies.
Have a question about this support post? Create a new support post in our support forums and include a link to this existing support post so we can help you.
Support forum for Event Espresso 3 and Event Espresso 4.