Support

Home Forums Event Espresso Premium Question Group created by other users

Question Group created by other users

Posted: February 21, 2014 at 11:30 pm


Kirk Childs

February 21, 2014 at 11:30 pm

As an admin why is it that I can see a Question Group created by another user but cannot use that Question Group on an event that I create?


Tony

  • Support Staff

February 24, 2014 at 3:57 am

Hi Kirk,

That is actually by design,with the Espresso Roles & Permissions Add-on each user has their own Question Groups & Promo codes to use within their own events.

However there is a filter in place we can use to remove the check for the current user. Just add

remove_filter('espresso_get_question_groups_for_event_where', 'espresso_rp_basic_get_question_groups_for_event_where', 10);

To wp-content/uploads/espresso/custom_functions.php (if the file is not there currently, create a blank php file, open with the opening php tag

<?php

Then paste the code above into that file.


Kirk Childs

February 24, 2014 at 6:44 pm

Okay uploaded the wp-content/uploads/espresso/custom_functions.php file with the following code

<?php
remove_filter(‘espresso_get_question_groups_for_event_where’, ‘espresso_rp_basic_get_question_groups_for_event_where’, 10);
?>

but not noticing any change in the interface.


Tony

  • Support Staff

February 25, 2014 at 3:36 am

Hi Kirk,

I’d advise against closing the PHP tag ‘?>’ as it helps avoid Headers already sent issues. (White space after the closing tag which can be hard to track down – More Info)

With that code in place all users should see the question groups created by other users within the Event Editor and be able to allocate those questions to their events if they wish, is that not the case?


Kirk Childs

February 26, 2014 at 4:12 pm

Removed the closing ?> php tag but still not seeing question groups from other users as choices when editing an event.


Tony

  • Support Staff

February 27, 2014 at 3:03 am

HI Kirk,

I must apologise, I had assumed you were using R&P Basic but looking at your account it would appear you are likely using R&P Pro.

If that is the case you will also need to add:

remove_filter('espresso_get_question_groups_for_event_where', 'espresso_rp_pro_get_question_groups_for_event_where', 15);

In the same custom_functions.php file.

Does that then allow you to view all question groups within the Event Editor?


Kirk Childs

March 3, 2014 at 1:14 pm

Added the line for R&P Pro but still not seeing others’ questions groups.

<pre class=”brush: php; gutter: true; first-line: 1; highlight: []; html-script: false”><?php
remove_filter('espresso_get_question_groups_for_event_where', 'espresso_rp_basic_get_question_groups_for_event_where', 10);
remove_filter('espresso_get_question_groups_for_event_where', 'espresso_rp_pro_get_question_groups_for_event_where', 15);


Sidney Harrell

March 3, 2014 at 4:47 pm

The default behavior is for only question groupss created by the wp_user ids of 0 and 1 to show up in the event editor. To get it to display all question groups you’ll need to add

add_filter('espresso_get_question_groups_for_event_where', 'custom_espresso_get_question_groups_for_event_where', 10, 3);
function custom_espresso_get_question_groups_for_event_where($where, $existing_question_groups, $event) {
	return '';
}

in addition to the code that Tony posted. Note that since each admin has their own set of question groups, you will see what seem to be duplicates, such as the Address information group. But if you hover over them, you will see that they each have a distinct group_id.


Kirk Childs

March 4, 2014 at 9:15 pm

that finally makes it work!

it would be awesome to show “Created by user x” next to each question group. I don’t mind too much having to look at the group id in the status bar. but i really can’t expect other event managers to do the same thing.

so just to clarify, this code is just for choosing questions right? in other words, if the code were to be removed next month, the existing data won’t be affected right?

because it’s custom code i totally understand it not looking perfect. but it would be great to have an official user-friendly version of this implemented in a future update.

P.S. (not sure what you all are doing to format code that my forum posts aren’t doing.)


Tony

  • Support Staff

March 6, 2014 at 5:20 am

Hi Kirk,

Those filters are only used when adding or editing an event.

If the code above were to be removed the only change would be that only the users that created the question/group would see those question again.

because it’s custom code i totally understand it not looking perfect. but it would be great to have an official user-friendly version of this implemented in a future update.

I agree and will add this to out internal feature request list.

Regarding code.
The forum is far stricter for forum users than admins, we often work around the formatting but for large sections of code we recommend using a service such a pastebin.com and including the link within the post.

Hope that helps.


Kirk Childs

March 18, 2014 at 2:49 pm

Not sure if it’s related to these changes we’ve added but a new problem just popped up. Out of the blue a couple questions have disappeared from the registration page.

As you can see in the screenshot below, Age & Gender questions are turned on in the settings. Also the “Show group name on registration page?” is turned off.

[IMG]http://i.imgur.com/EspOu1R.png[/IMG]

In the screenshot below note the way Age & Gender questions do not show up. Also the group name is being displayed.

[IMG]http://i.imgur.com/R2RjqAn.png[/IMG]

It can’t be an issue of using the wrong Question Group because, as you can see in the screenshot below, there is only one Personal Information group and as a system group is automatically selected and cannot be turned off.

[IMG]http://i.imgur.com/kngUzTt.png[/IMG]

What is causing this to happen and how can it be fixed?


Josh

  • Support Staff

March 19, 2014 at 2:40 pm

Hi Kirk,

Are the questions assigned to the corresponding question groups? You can find out if the issue is related to the code changes by temporarily removing the custom code as well.


Kirk Childs

March 20, 2014 at 6:09 pm

It strangely fixed itself. Actually, fixed it by saving the event without making any changes. Why would simply saving the event (making no changes) fix the problem with the questions?


Dean

March 24, 2014 at 12:15 am

Hi Kirk,

Good question and one that’s hard to answer. It could simply be the act of saving reset something that was needed.

Currently it would be a good idea to monitor the issue and see if it re-occurs, and if it does so, get in touch with us.

The support post ‘Question Group created by other users’ 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