Support » Plugin: BuddyPress Global Search » Exclude Users using bp_ajax_querystring

  • Resolved 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?


Viewing 5 replies - 1 through 5 (of 5 total)
  • 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:

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


    Cool, Glad you figure out yourself.


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


    Plugin Author BuddyBoss


    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?


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