Skip to:
Content
Pages
Categories
Search
Top
Bottom

Reply To: how to make buddypress private

@azaleamollis

Participant

I don’t know if there’s a good plugin for this but you can add a custom function to your bp-custom.php file that achieves the same result. You can read how to make a bp-custom.php file here in the BP Codex.

When your bp-custom.php file is ready, you add this function to the file:


<?php
function restrict_bp_pages() {
	
	global $bp;
	
	if( bp_is_blog_page() || bp_is_register_page() || bp_is_activation_page() ) {
		return;
	}
	
	if( !is_user_logged_in() ) {
		bp_core_redirect( $bp->root_domain .'/YOUR-LOGIN-SLUG' );
	}	
	
}
add_action( 'get_header', 'restrict_bp_pages' );

You insert the slug of your login page in the place of YOUR-LOGIN-SLUG into the code above. E.g. if your login page is http://www.mypage.com/mylogin, your insert ‘/mylogin’. If you want to use your home page you leave out this part and only use bp_core_redirect( $bp->root_domain );.

Then you upload the bp-custom.php file into the /wp-content/plugins/ folder on your server, and you’re ready.

Skip to toolbar