I tried adding the below pasted snippet to my bp-custom.php file inside my plugin folder and it worked for the activity page. I dont want to sound like a complete noob but can someone tell me how do i replicate this for the members and group page?
I tried variations of the code to support _groups_component and _members_component but that didnt work.
/* Prevent logged out users from accessing bp activity page */
function nonreg_visitor_redirect() {
global $bp;
if ( bp_is_activity_component() ) {
if(!is_user_logged_in()) { //just a visitor and not logged in
wp_redirect( get_option(‘siteurl’) . ‘/wp-login.php’ );
}
}
}
add_filter(‘get_header’,’nonreg_visitor_redirect’,1);