Pastebin launched a little side project called VERYVIRAL.com, check it out ;-) Want more features on Pastebin? Sign Up, it's FREE!
Guest

Exclude Users from Directory

By: sbrajesh on Jan 29th, 2012  |  syntax: PHP  |  size: 0.74 KB  |  views: 394  |  expires: Never
download  |  raw  |  embed  |  report abuse  |  print
Text below is selected. Please press Ctrl+C to copy to your clipboard. (⌘+C on Mac)
  1. add_action('bp_ajax_querystring','bpdev_exclude_users',20,2);
  2. function bpdev_exclude_users($qs=false,$object=false){
  3.     //list of users to exclude
  4.    
  5.     $excluded_user='1,2,3';//comma separated ids of users whom you want to exclude
  6.    
  7.     if($object!='members')//hide for members only
  8.         return $qs;
  9.    
  10.     $args=wp_parse_args($qs);
  11.    
  12.     //check if we are searching for friends list etc?, do not exclude in this case
  13.     if(!empty($args['user_id'])||!empty($args['search_terms']))
  14.         return $qs;
  15.    
  16.     if(!empty($args['exclude']))
  17.         $args['exclude']=$args['exclude'].','.$excluded_user;
  18.     else
  19.         $args['exclude']=$excluded_user;
  20.      
  21.     $qs=build_query($args);
  22.    
  23.    
  24.    return $qs;
  25.    
  26. }