• Resolved bjarvis

    (@bjarvis)


    I have two forums for 2 separate groups. I would like to use AJAX Search Light to search only on the specific forum for each group instead of searching both forums. Is there a way to do this with the AJAX Search Lite Plugin?

Viewing 5 replies - 1 through 5 (of 5 total)
  • Plugin Author wpdreams

    (@wpdreams)

    Hi!

    It might be possible to construct a small custom code snippet to check the results against the groups, but for that I need to know what plugin/solution do you use for forums.

    Let me know, and I will look up ther API, if exists.

    Best regards,
    Ernest M.

    Thread Starter bjarvis

    (@bjarvis)

    I’m using bbpress … thanks.

    • This reply was modified 6 years, 7 months ago by bjarvis.
    Thread Starter bjarvis

    (@bjarvis)

    Hi Ernest,

    Just wondering if there is anything that will work for a single forum search here. If not, I completely understand and I’ll keep looking. But if there is something please let me know as I need to find a solution.

    Thanks so much for any help on this.

    • This reply was modified 6 years, 7 months ago by bjarvis.
    Plugin Author wpdreams

    (@wpdreams)

    Hi,

    Try adding 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!

    add_filter('asl_results', 'asl_restrict_by_forum_id', 10, 4);
    function asl_restrict_by_forum_id($results, $id, $is_ajax, $args) {
      $forum_id = 1;
      
      foreach ($results as $k=>&$r) {
        $id = get_post_meta($r->id, '_bbp_forum_id', true);
        if ( $id != $forum_id ) 
          unset($results[$k]);
      }
      return $results;
    }

    Change the $forum_id variable to the forum ID in which you want to allow the search for content & replies.
    Hopefully it will do the trick.

    Best regards,
    Ernest M.

    Thread Starter bjarvis

    (@bjarvis)

    Thank you.

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘Search in specific forum id’ is closed to new replies.