Support

Home Forums Community Forum Template Over Ride to Dynamically Choose which Question Group to display?

Template Over Ride to Dynamically Choose which Question Group to display?

Posted: September 4, 2014 at 12:41 pm


Adam Bowen

September 4, 2014 at 12:41 pm

Hello I am curious if it is possible to use a template over ride to determine which question group to display to the user. I have two different types of registered users and want to show a different question group based on the users role.

I looked at registration_page.php but not seeing anything related to the question_group.

Can someone point me in the right direction or maybe an action or filter etc?


Dean

September 5, 2014 at 4:30 am

Hi,

I assume this is for EE3?

There are no hooks, but you could edit the registration_page.php template and modify the $question_groups array.

This array has the ID’s of the question groups to be displayed, so you could run a simple if-else statement and unset the elements you don’t want.

If you are editing this template, please copy registration_page.php AND registration_page_display.php over to wp-content/uploads/templates/ and edit them there, this will stop plugin updates from over writing your modifications.


Adam Bowen

September 5, 2014 at 7:14 am

Thank you that makes sense but can you provide an example. What do I need to manually display a specific question group.

I found $question_groups = unserialize($event->question_groups);

So I was just going to comment that out and if get this group else get that group etc.


Adam Bowen

September 5, 2014 at 8:41 am

Ok I figured it out. This is what I used I did an if statement to check current users role. Then $question_groups = ‘a:1:{i:1;s:1:”3″;}’; The 3 in this is the id of the question group.

Just wanted to update this in case anyone else searches for the same thing. If you want multiple forms the best way to do that is go and edit an event, check each question group you want for that event. Then go and look in the event_details db table column question_groups from there you will see how this is formatted etc.

Thanks again for pointing me in the right direction.


Dean

September 8, 2014 at 2:19 am

Glad you got it figured out and you’re welcome.

The support post ‘Template Over Ride to Dynamically Choose which Question Group to display?’ 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