This code snippet excludes members, based on the role they have, from the buddypress members loop. Change the roles to your preference.
bp-custom.php
function exclude_roles_from_members_loop( $retval ) {
if ( bp_is_members_directory() ) {
$exclude_ids = get_users(
array(
'fields' => 'ID',
'role__in' => array( 'editor', 'author' ) // change the roles here
)
);
$retval['exclude'] = $exclude_ids;
}
return $retval;
}
add_filter( 'bp_before_has_members_parse_args', 'exclude_roles_from_members_loop' );