Hi,
“member” is a core component of BuddyPress and can’t be disabled. You need the “member” slug (or what ever you may use as custom slug) in the wp environment, for example to fire profiles, messages and so on.
You want to obfuscate or forbid the member directory. That’s ok. Let’s make it simple and stupid! One possibility would be to add a restriction on the directory template. For example, you could allow only the site admin to access that part. Other roles will get a message instead (or nothing at all, or a redirection…).
If i’m right, the directory template is in bp-legacy/buddypress/members/index.php
Condition you could use:
if ( !is_super_admin() ) {
echo 'This page is not public';
} else {
// here the template content
}
To use this solution you need to use a child theme.
There are many other ways to accomplish what you want. Here the most simple(imo), but you can go to overcomplicated and very sophisticated too.
It seems this directory stuff was depracated in the location you mentioned. Does this still exist? I need to hide this page too from anyone not admin. We use this in the medical space, so we WANT to show those that are assigned as Therapists, but we CANNOT show the people that sign up as a patient.
Hi @jchretien, in lieu of trying to hide the Members directory; have you considered using Member Types as a way to filter which Members are listed within the Members directory (as in admin (list all) vs non-admin (only list Therapists)?
@jchretien
Replace ‘your_member_type’ with the actual slug of your desired member type.
function wbcom_custom_bp_members_filter($args) {
// Only apply the filter for non-admin users
if (!current_user_can('manage_options')) {
// Specify the member type you want to display
$desired_member_type = 'your_member_type';
// Set the member_type argument to filter the members list
$args['member_type'] = $desired_member_type;
}
return $args;
}
add_filter('bp_after_has_members_parse_args', 'wbcom_custom_bp_members_filter');