Home › Forums › Product Support Forums › Ajax Search Pro for WordPress Support › Exclude user groups
This topic contains 9 replies, has 2 voices, and was last updated by Ernest Marcinko 4 years, 4 months ago.
- AuthorPosts
- October 26, 2018 at 6:05 am #19628
Hi!
Thanks for your plugin, it seems to work fine, but i have a question about user groups.Is it somehow possible to exclude certain user groups to see live search results in vertical searh bar?
I am working on a woocommerce site that contains few special usergroups, say users1, users2, and users3 and only those can see a certain products (Product Visibility by User Role for WooCommerce, pro version). I want that other customers and visitors would not be able to see livesearch results in searchbar (hidden products) when searching.
Now the situation is, that the guests etc. can’t see the products in the shop pages (which is what i want) but they are able to see product listing in searchbar and that’s not what i want.
So i want search results in search bar to be visible only for registered users.
Hope you understood what i ment.
October 26, 2018 at 8:50 am #19632Hi!
I think this might be doable with a bit of custom code. I am not familiar with that plugin though, and the inner functioning.
Can you please add temporary FTP and back-end access? I would like to experiment with a custom code, as well as check on that plugins source to see if I can find how these visibility exclusions are handled. I might be able to find a solution.Thank you!
Best,
Ernest Marcinko
If you like my products, don't forget to rate them on codecanyon :)
October 26, 2018 at 9:18 am #19634You cannot access this content.October 26, 2018 at 9:59 am #19635You cannot access this content.October 26, 2018 at 12:39 pm #19637You cannot access this content.October 26, 2018 at 5:34 pm #19653Thanks!
I have installed the plugin, and looked through it’s code for a possible usable API. I have found a solution, which will probably work. But please note, that this is not an optimal solution whatsoever, and I am not sure how will it affect the overall search performance, but this is the most I was able to achieve within a reasonable timeframe. While customization is not part of support, I was trying to get the best out of this, as possible.
Add this custom code to the functions.php in your theme/child theme directory (copy from line 3 only!). Before editing, please make sure to have a full site back-up just in case! This code will alter the search arguments, to allow only post IDs which are meant to be seen for the current user.
I really hope this helps!
Best,
Ernest Marcinko
If you like my products, don't forget to rate them on codecanyon :)
October 26, 2018 at 11:36 pm #19655Hi! Thanks for effort.
That solution wont work. No effect at all.
Toke
October 27, 2018 at 8:51 am #19656Hi Toke,
Also, in the plugin source, there is a mention of term meta table compatibility. This code is constructed based on that compatibility being set to default. I have not been able to find this option though, and I am not sure if it’s in use anywhere, as I only seen a mention in the source. Do you happen to know what that is, and if yes, do you have it set? That might change the outcome.
I have also made a tiny change to the final code, so that the plugin class existence check is omitted. Can you please try this variation as well? Make sure it is in the correct functions.php file, sometimess I mistake the active theme directories 🙂
Best,
Ernest Marcinko
If you like my products, don't forget to rate them on codecanyon :)
November 1, 2018 at 6:28 am #19712Thanks for trying, but the code is not working. No effect whatssoever.
Toke
November 1, 2018 at 9:09 am #19714I honestly don’t know then. It must be some sort of a difference within the configuration or something.
If you can arrange temporary FTP and back-end to a test server, I more than happy to give it a try there. Let me know!
Best,
Ernest Marcinko
If you like my products, don't forget to rate them on codecanyon :)
- AuthorPosts
You must be logged in to reply to this topic.