Categories
Code WordPress

BuddyPress: Disable the Public Members Directory

Disable access to the default BuddyPress Members Directory.

The following code snippet can be used to disable access to the default BuddyPress Members Directory.  Simply add the following code to your theme’s functions.php file.

//Disable members directory
function disable_directory_members() {
 global $bp, $wp_query;
 $bp_is_directory = false;
 bp_core_redirect( $bp_root_domain );
}
add_action( 'bp_core_action_directory_members', 'disable_directory_members', 2 );

Update – 11/17/2011:  As of BuddyPress v1.5 this post this method is deprecated. You can now achieve this same result by unpublishing the ‘Members’ page from the ‘Pages menu in the admin area.

4 replies on “BuddyPress: Disable the Public Members Directory”

@AllMad.org — You are correct! This post was created prior to BP 1.5. You can now achieve this same result by unpublishing the ‘Members’ page from the ‘Pages menu in the admin area.

Hi, just wondering if you could help. Rather than delete the directory, is there a way to only show a certain role? I.e. if I only waned to show contributors and not subscribers?

@ David: On BP 1.5 you can still wrap the relevant pages to be blocked / shown.

Just after

You could add

… here comes all the code for the page

….Whatever you want to show for non-members. E.g. re-Direct or login.

Probs are: BP has still all RSS links open, those would need to be edited as well.

Leave a Reply

Your email address will not be published.

This site uses Akismet to reduce spam. Learn how your comment data is processed.