Home › Forums › Product Support Forums › Ajax Search Pro for WordPress Support › Groups and hide products
This topic contains 6 replies, has 2 voices, and was last updated by Ernest Marcinko 5 years, 6 months ago.
- AuthorPosts
- February 20, 2019 at 1:36 pm #21196
hi Ernest,
Firstly – loving the plugin, it has unlocked so many more features than i had expected and I am spending WAY to long on getting the perfect search!! 🙂
Question, I have tried the below and added the code to my functions.php on my child theme:
I see no change though and products keep popping up that shouldn’t.. The plugin is restricting access to theproducts as expected – I just need them to stop showing up unless part of the user group!
February 20, 2019 at 1:51 pm #21199Hi!
Thank you for your kind words, I really appreciate them!
I tried to log-in with the details, but it says, that the password is incorrect. Can you please check that? If you are using the Groups plugin, and it’s not working, then can you please also add temporary FTP access as well? I would like to debug through that custom code to see what exactly is happening there.
Best,
Ernest Marcinko
If you like my products, don't forget to rate them on codecanyon :)
February 20, 2019 at 1:52 pm #21200You cannot access this content.February 20, 2019 at 1:57 pm #21201You cannot access this content.February 20, 2019 at 2:37 pm #21202Hi,
Thank you very much!
I think I managed to find a solution based on the plugin API. The category based exclusions seem to have a different API, so the code needs to be extended. The final solution is:
add_filter('asp_results', 'asp_fix_groups_exclusions', 10, 1); function asp_fix_groups_exclusions($results) { // Group based exclusions if ( class_exists('Groups_Post_Access') ) { foreach ($results as $k => &$r) { if ( isset($r->post_type) && !Groups_Post_Access::user_can_read_post($r->id) ) unset($results[$k]); } } // Category based exclusions if ( class_exists('Groups_Restrict_Categories') ) { foreach ($results as $k => &$r) { if ( isset($r->post_type) && !Groups_Restrict_Categories::user_can_read($r->id) ) unset($results[$k]); } } return $results; }
Please check if this is correct. Thanks!
Best,
Ernest Marcinko
If you like my products, don't forget to rate them on codecanyon :)
February 20, 2019 at 2:38 pm #21203I literally just logged on to test something and saw it was working!
You sir are a genius 🙂
February 20, 2019 at 2:40 pm #21204You cannot access this content. 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.