Skip to content

@sbrajesh /hide-subscribers.php
Last active

Embed URL


Subversion checkout URL

You can clone with
Download ZIP
Hide Subscriber Users from BuddyPress member Directory
function bpdev_exclude_users($qs=false,$object=false){
//list of users to exclude
if($object!='members')//hide for members only
return $qs;
$excluded_user=join(',',bpdev_get_subscriber_user_ids());//comma separated ids of users whom you want to exclude
//check if we are searching for friends list etc?, do not exclude in this case
return $qs;
return $qs;
function bpdev_get_subscriber_user_ids(){
$subscribers= get_users( array( 'role' => 'subscriber', 'fields' => 'ID' ) );
return $users;

You can replace the entire bpdev_get_subscriber_user_ids() function, with this single line of code:

$excluded_user = implode(',',get_users('role=subscriber&fields=ID'));

What if you wanted to hide Administrators as well as Subscribers?


I want to Hide Subscriber Users from BuddyPress member Directory. Where exactly should I create the hide-subscribers.php file, in which folder? I'm a novice at this so any details that you can provide to help me with this will be greatly appreciated. Thank you.


Please explain bit more i want hide the subscriber user role in buddypress member list, then i want to know how to use this hook code used in another plugin


inxys: in case you're still wondering, you'll want to paste the code in "custom_buddypress/bp-functions.php"


I have updated the code. Please be warned that it had serious performance issues due to an oversight. If you are using it, Update the code.


so this goes in members loops ?
I want to show only members that have a certain pmpro level

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.