Home › Forums › Product Support Forums › Ajax Search Pro for WordPress Support › Searching private and hidden groups
This topic contains 26 replies, has 2 voices, and was last updated by Sandy 5 years, 2 months ago.
- AuthorPosts
- January 23, 2019 at 2:55 pm #20944You cannot access this content.January 24, 2019 at 8:06 am #20954You cannot access this content. Best,
Ernest Marcinko
If you like my products, don't forget to rate them on codecanyon :)
January 24, 2019 at 9:37 am #20963You cannot access this content.January 24, 2019 at 3:43 pm #20967Hi,
Thank you, I may have found a possible solution, I am not sure. If you add the parent forum of that document to the filters list, it should be excluded now.
For future reference, I have constructed the following code into the functions.php file in your child theme directory:
Best,// -- AJAX SEARCH PRO SPECIFIC -- add_filter('asp_results', 'asp_results_filter_attachments', 10, 4); function asp_results_filter_attachments($results, $id, $is_ajax, $args) { if ( isset($args['post_meta_filter']) ) { $ids = array(); foreach ( $args['post_meta_filter'] as $pm ) { if ( $pm['key'] == '_bbp_forum_id' ) $ids[] = $pm['value']; } if (count($ids) > 0) { foreach ($results as $k => &$r) { if (isset($r->post_type) && $r->post_type == 'attachment') { $pid = wp_get_post_parent_id( $r->id ); $forum_id = (int)get_post_meta($pid, '_bbp_forum_id', true); while ( !empty($forum_id) ) { if ( in_array($forum_id, $ids) ) { unset($results[$k]); break; } $forum_id = wp_get_post_parent_id( $forum_id ); } } } } } return $results; }
Ernest Marcinko
If you like my products, don't forget to rate them on codecanyon :)
January 24, 2019 at 4:30 pm #20970Hi,
Do you mean i should make an exclude rule to each search for each forum which has attachements?
This site is going to have many different forums not sure if that’s manageable, or did you mean something else?Best,
-SandyJanuary 25, 2019 at 9:26 am #20974Hi,
Isn’t that what you need? I thought you want to hide attachments from specific forums.
Best,
If you simply don’t want any attachments, you can turn off the attachments search.
Ernest Marcinko
If you like my products, don't forget to rate them on codecanyon :)
January 25, 2019 at 9:30 am #20975Good morning Ernest,
i do want to show Attachements in the search, so if i have 20 forums all with attachments should i make 19 exclude rules for each dedicated search?
Best,
-SandyJanuary 25, 2019 at 10:13 am #20976Hi Sandy,
It might be the only solution. Unfortunately there is no direct connection between the forum and the attachment, only the topic/reply and the attachment.
Best,
I could somehow modify the code so that for each search instace there is only a number of allowed forums for attachments, in that case you wouldn’t need those rules for the attachments.
If you can make a list of which search ID should display attachments from which forum IDs only, let me know. I will try to add that to the code.
Ernest Marcinko
If you like my products, don't forget to rate them on codecanyon :)
January 30, 2019 at 1:50 pm #21035You cannot access this content.February 5, 2019 at 12:28 pm #21046Hi Ernest,
Hope you have some time to look into this.
Thanks,
-SandyFebruary 11, 2019 at 1:01 pm #21052Hi Sandy,
Sorry for the late response, we were on a short family vacation.
I believe the custom code I did there is causing the problem, as it is explicitly made for exclusions, but not inclusions, it won’t work that way. Can you please try without using the custom code?
Best,
Ernest Marcinko
If you like my products, don't forget to rate them on codecanyon :)
February 12, 2019 at 10:11 am #21071Hi Ernest,
Hope you had a great holiday!
In the end i removed the subforums, so now it’s working,
but in the feature i will need this to work.Best,
-Sandy - AuthorPosts
You must be logged in to reply to this topic.