• Resolved sitesforchrist

    (@sitesforchrist)


    We are using bp_ajax_querystring to exclude certain users from our default search results. But it doesn’t appear to be working with the global search plugin. Is it possible to hook into this function (or another one) within the global search plugin in order to achieve the same results?

    Thanks!
    Sarah

Viewing 5 replies - 1 through 5 (of 5 total)
  • Thread Starter sitesforchrist

    (@sitesforchrist)

    Nevermind, I was able to figure out how to do this using the following code in case it helps someone else. It’s kind of patch-y, but it works:

    add_filter('BBoss_Global_Search_Members_sql','exclude_users_global_search');
    function exclude_users_global_search($sql){
    	$exclude = '1,10,6'; //comma separated ids of users whom you want to exclude
    	
    	$sql = str_replace('u.id IN', 'u.ID NOT IN (' . $exclude. ') AND u.ID IN', $sql);
    	
    	return $sql;
    }
    Plugin Author BuddyBoss

    (@buddyboss)

    Cool, Glad you figure out yourself.

    Hi,

    I’d like to try this- can you let me know what file to add it to?

    Thanks

    Plugin Author BuddyBoss

    (@buddyboss)

    @catonezillion,
    You can add above codes inside your child theme functions.php

    Thanks! Now that I think of it- it may be better to exclude by member type or role- can that be done?

    Cathy

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘Exclude Users using bp_ajax_querystring’ is closed to new replies.