Exclude user groups

This topic contains 9 replies, has 2 voices, and was last updated by Ernest Marcinko Ernest Marcinko 5 years, 5 months ago.

Viewing 10 posts - 1 through 10 (of 10 total)
  • Author
    Posts
  • #19628
    toke
    toke
    Participant

    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.

    #19632
    Ernest Marcinko
    Ernest Marcinko
    Keymaster

    Hi!

    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 :)


    #19634
    toke
    toke
    Participant
    You cannot access this content.
    #19635
    toke
    toke
    Participant
    You cannot access this content.
    #19637
    toke
    toke
    Participant
    You cannot access this content.
    #19653
    Ernest Marcinko
    Ernest Marcinko
    Keymaster

    Thanks!

    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 :)


    #19655
    toke
    toke
    Participant

    Hi! Thanks for effort.

    That solution wont work. No effect at all.

    Toke

    #19656
    Ernest Marcinko
    Ernest Marcinko
    Keymaster

    Hi 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 :)


    #19712
    toke
    toke
    Participant

    Thanks for trying, but the code is not working. No effect whatssoever.

    Toke

    #19714
    Ernest Marcinko
    Ernest Marcinko
    Keymaster

    I 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 :)


Viewing 10 posts - 1 through 10 (of 10 total)

You must be logged in to reply to this topic.