Posted: December 1, 2020 at 10:15 pm
|
Greetings, When configuring “Question Groups” it would be very helpful if the text list of “Questions” also (or in place of) displayed the “Question Label (admin-only)” text. I have several questions that have the same “Question Text” and mapping them as is can be confusing. It seems by the definition you have listed in help for the “Question Label (admin-only)” this was the intended use for this field. Let me know if this is possible today. If not please turn in an enhancement request for me if you would. Thank you! |
Hi there, This is possible to do but you’ll need to override the template used within Event Espresso on the Question Group edit, are you comfortable with PHP? |
|
|
Greetings Tony, if you walk me through the changes in PHP I can make them. I hate to update the files that an update will overwrite. I try when possible to put updates in the child theme functions.php file. I have a few “add_filter” in there to change some basic text for Event Espresso today. |
If the only way to change this was indeed to change core files then I wouldn’t class that as a solution and would simple reply with it’s not currently possible as we don’t support editing core files (we do make an exception from time to time if its something like adding a filter that we then know will also be included in the next release).
The themes functions.php file should hold functions that specifically affect the theme itself. I can’t tell you what functions as its different for everyone but anything that you want to keep applied even after changing your theme, should really go in a custom functions plugin: https://eventespresso.com/wiki/create-site-specific-plugin-wordpress-site/
Those are generally a good example of the above as if you did change themes you would likely still want those text changes to apply, meaning they would be ‘better’ in a plugin. However, it’s really up to you 🙂 — So to do this you need to override a template within Event Espresso, but that doesn’t mean you need to edit the template within EE itself. Create a site specific plugin using the documentation above. Within that plugins directory also create a ‘templates’ directory. In the custom functions plugin file, add this code: https://gist.github.com/Pebblo/cf18ff686cca964193cbd8026c2c3379 What that code does is hook into the display_template method within Event Espresso and allows you to override the path for a template file. The Now, you have a plugin that loads a custom version of Go to Grab a copy of If you just want to swap out question test for the adin label then lines 184 – 190
Change both That’s it, you’re now loading your own custom version of the template and you’ve switched over to using the admin label without modifying core. |
|
|
Greetings Tony, That worked perfectly. Thank you for the info! I assume if I ever have an issue with that page I can disable the plugin and see if the issue goes away. If it does, I may need to update the question_groups_main_meta_box.template.php to the latest version and modify it again. I had edited the functions.php file based on the link below but I have now moved that code into the custom plugin. https://eventespresso.com/topic/change-ticket-selector-heading-text/ Thanks again for your help! |
Yeah you’ll need to make sure you keep up with updates to that file but we do try to keep any business logic outside of the templates, they just control the display so you shouldn’t run into any issues even if we change the original a little.
It’s common to just use In the end, if it works, it works. It’s only when you start changing themes and your customizations vanish that it becomes something you need to think about so I tend to favour a custom plugin unless the functionality is specific to the theme itself (like changing a string that the theme itself added etc). |
|
|
Greetings Tony, I have a follow-up question related to this topic. When looking at a user’s registration on the back end under the “Registration Form Answers” section, is it also possible to update that template to display the “Question Label (admin-only)” text as opposed to the “Question” text? Let me know when you have a chance. Thank you! |
I checked into this and currently, it’s not easily done. There is a hook available that allows you to completely override the method used to output that form, but to switch over to using the admin label text you’ll need to basically re-create your own function that outputs the same as what is available now but using the admin label. |
|
|
Thank you for checking Tony. I recently had conditional questions implemented on my front end so that attendees would be provided different questions and question groups depending on which ticket they selected. Because of this, I have several questions that have the same label but have different options. Only the end admin label is different. This can get confusing on the backend. Originally I was going to have my developer hide the questions on the backend like it is being done on the front end but those hooks are not present on the backed according to them. I thought updating to show the admin label would be a good second choice but it sounds like those hooks are not present either. As a feature request can you ask to have hooks added to allow for hiding of questions/question groups on the backend as well as the use of the admin label? Let me know if you have any questions. |
There is a hook available they can use to completely override the default output:
Its a filter so return
I’ll double-check with the developers on this to confirm something isn’t available already. |
|
|
Thank you for checking Tony. |
The support post ‘Question Group to Questions Mapping Name’ 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.