Thanks. I tried another piece of code in my bp-custom.php file, and it seemed to do the job perfectly. Now, non-logged in users can’t view any of my BP pages, and they get redirected to my register page:
function kleo_page_template_redirect()
{
//if not logged in and on a bp page except registration or activation
if( ! is_user_logged_in() && ! bp_is_blog_page() && ! bp_is_activation_page() && ! bp_is_register_page() ) {
wp_redirect( home_url( '/register/' ) );
exit();
}
}
add_action( 'template_redirect', 'kleo_page_template_redirect' );