Reply To: Disallow Non logged users on certain pages
Try This Code :
add_action( 'wp', 'custom_lockdown_redirect', 3 );
function custom_lockdown_redirect(){
global $wp;
if (!is_user_logged_in()){
if ( bp_is_activation_page()
|| bp_is_register_page()
|| ( in_array( $GLOBALS['pagenow'], array( '/login' )))
)
return;
bp_core_redirect(get_option('http://yoursite.com') . "/login");
exit;
}
}
Make sure the you change /login with your login link.
Add it to your theme’s function.php file