Support

Home Forums Event Espresso Premium Accessing Question Group Answers on Thank You Page

Accessing Question Group Answers on Thank You Page

Posted: March 4, 2019 at 7:34 am


Antenna Digital

March 4, 2019 at 7:34 am

My end client uses something called PassKey for event specific hotel registration. So on the thank you page from event registration I need to build a link that the user can click to go to the hotel. The link contains name/address/email/etc as well as the appropriate PassKey Event Id and such (I’m using Advanced Custom Fields for that and it’s working great).
Here’s a sample link: https://api.passkey.com/RegLink/API?PartnerID=1234567&Organization=XXXXXXXX&OP=CreateBridgeAndRedirectResWeb&Destination=02&Version=4.00.00&Mode=S&State=CA&CountryCode=US&City=Test City&LastName=Test&FirstName=Dave&eventCode=LEAATT01234567&eventID=1234567&Address1=123 Test Road&EmailAddress=daveh@formtest.xyz&WorkPhone=1234567890&ZipCode=90210

So at this point, I need the value the user entered in the ‘Company’ Question that I added to the Address Question Group for that event. This is the part of the link I’m trying to populate: Organization=XXXXXXXX

I output the value of $registration using print_r() but Company does not appear in the output. (nor do any other questions)

How can I get this info?


Tony

  • Support Staff

March 4, 2019 at 2:28 pm

Hi there,

Which hook are you currently using?

$registration is an EE_Registration object, correct?

I output the value of $registration using print_r() but Company does not appear in the output. (nor do any other questions)

Questions/Answers are not stored within the registration itself so you won’t find them in the EE_Registration object.

However, if you have the EE_Registration object you can use something like:

$question_id = 11; //Assuming the ID of your 'Organization' question is 11

$organization_ans_obj = EEM_Answer::instance()->get_registration_question_answer_object( $registration, $question_id );

if ( $organization_ans_obj instanceof EE_Answer ){
    //If we have an answer object, echo the 'pretty' value for it.
    $organization = $answer_obj->pretty_value();
}

Rather than using print_r() for our Model objects I highly recommend using Kint Debugger and wrapping the vars in d();, the output is much easier to follow and you can view all of the available methods on the object.

The support post ‘Accessing Question Group Answers on Thank You Page’ 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.

Event Espresso