Assuming the user_id for the admin is 1, try this:
function infok_exclude_users($qs=false,$object=false){
//list of users to exclude
$excluded_users = '1'; //comma separated ids of users whom you want to exclude
if($object!='members')//hide for members only
return $qs;
$args=wp_parse_args($qs);
//check if we are searching for friends list etc?, do not exclude in this case
if(!empty($args['user_id']))
return $qs;
if(!empty($args['exclude']))
$args['exclude']=$args['exclude'].','.$excluded_users;
else
$args['exclude']=$excluded_users;
$qs=build_query($args);
return $qs;
}
add_action('bp_ajax_querystring','infok_exclude_users',20,2);
I already have this bit of code
add_action('bp_ajax_querystring','bpdev_exclude_users', 20, 2 );
function bpdev_exclude_users($qs=false,$object=false){
global $count_of_excluded_members;
global $count_of_included_members;
$count_of_excluded_members = 0;
if ($object != 'members') {
return $qs;
}
$subscribers = get_users('role=subscriber');
$exclude = "";
foreach ($subscribers as $subscriber) {
if (trim($exclude) != "") {
$exclude = $exclude . ",";
}
$exclude = $exclude . $subscriber -> ID;
$count_of_excluded_members++;
}
$administrators = get_users('role=administrator');
foreach ($administrators as $administrator) {
if (trim($exclude) != "") {
$exclude = $exclude . ",";
}
$exclude = $exclude . $administrator -> ID;
$count_of_excluded_members++;
}
$count_of_included_members = 0;
$editors = get_users('role=editor');
foreach ($editors as $editor) {
$count_of_included_members++;
}
$contributors = get_users('role=contributor');
foreach ($contributors as $contributor) {
$count_of_included_members++;
}
$args = wp_parse_args($qs);
$args['exclude'] = $exclude;
$qs = build_query($args);
return $qs;
}
Which puts 1 in the exclude list and it goes through there so it doesn’t make sense to me
The function I provided works.
It removes a member with ID = 1 from the members loop.
If you want to use some other function or use 2 or more functions that hook to bp_ajax_querystring, then I can’t help you.
I agree it should do but as you see it doesn’t unless something else later on is amending the exclude