Forums › Forums › Search & Filter Pro › Custom template only being displayed for users with admin role
- This topic has 8 replies, 2 voices, and was last updated 10 years, 3 months ago by Ross.
-
Anonymous(Private) June 28, 2014 at 8:32 pm #1949
I’m having this strange issue where the custom template I’ve specified for a search form is only being displayed to users with the admin role.
it looks like it is failing here in class-search-filter.php:
public function handle_template($original_template) { global $sf_form_data; if($sf_form_data->is_valid_form())
any ideas?
Anonymous(Private) June 29, 2014 at 5:01 am #1951I was able to resolve my issue by changing the priority of the ‘pre_get_posts’ filter in class Search_Filter_Setup_Query
i changed this line from:
add_filter('pre_get_posts', array($this, 'filter_query'), 20);
to
add_filter('pre_get_posts', array($this, 'filter_query'), 10);
do you think changing this priority will break something else? is there a reason why you had it at 20?
thanks!
Ross Moderator(Private) June 29, 2014 at 1:05 pm #1956Hey Morgan thanks for the update.
The lower priority means it will be called later and after other plugin code, so I am unsure what is happening but it seems like you may have some other code that also tries to modify the template that is being used to display?
I would like to figure out the problem with you as otherwise future updates will keep breaking for your setup!
Thanks
Anonymous(Private) June 29, 2014 at 3:14 pm #1959thanks Ross – agreed I’d love to sort this out too.
i’ve got a little more info .. looks like there is a conflict with a plugin called “BuddyPress Docs” – when i disable this plugin and set the priority back to 20 on your method things work as expected
i see several uses of pre_get_posts in the Budypress Docs code base .. but I’m a little over my head trying to figure out if one of these 2 plugins should be doing something slightly different to make it more compatible in general with other plugins
would it be possible for you to put Buddypress and Buddypress Docs on a test site along with Search Filter Pro and see if you can replicate my problem?
i guess Buddypress Docs must be doing something so that $query->is_main_query() fails in Search Filter Pro
Ross Moderator(Private) July 3, 2014 at 1:57 am #2108Hey Morgan, going to take a look at this this weekend and see what I can do 🙂
Ross Moderator(Private) August 19, 2014 at 9:20 pm #3778Hey Morgan totally slipped my mind with the last update.
Quick question, do you use ajax to display your results? There is a new way to use Ajax which uses its own instance of WP_Query so you shouldn’t be getting in to these kinds of troubles 🙂
Let me know anyway and I’ll do some further explaining!
-
AuthorPosts