BuddyPress: Disable the Public 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.

You may also like...

4 Responses

  1. Now that BP1.5 uses regular WP pages for their components, couldn’t you just delete the page or whatever?

    • Steven Word says:

      @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.

  2. David says:

    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?

  3. Eilert says:

    @ 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. Required fields are marked *

%d bloggers like this: