Try this plugin:
https://wordpress.org/extend/plugins/restricted-site-access/
`
Just place this between opening and closing php tags in the bp-custom.php file:
`
On the below line you can change the /register to the page you want them redirected too!
wp_redirect( get_option(‘siteurl’) . ‘/register’ );
For example:
wp_redirect( get_option(‘siteurl’) . ‘/activity’ );
Sorry the code got stripped out. Here is another try!
function bp_guest_redirect() {
global $bp;
if ( bp_is_activity_component() || bp_is_groups_component() /*|| bbp_is_single_forum()*/ || bp_is_forums_component() || bp_is_blogs_component() || bp_is_page( BP_MEMBERS_SLUG ) ) {
// enter the slug or component conditional here
if(!is_user_logged_in()) { // not logged in user
wp_redirect( get_option(‘siteurl’) . ‘/register’ );
} // user will be redirect to any link to want
}
}
add_filter(‘get_header’,’bp_guest_redirect’,1);
Do you use the plugin with the bp-custom.php or use one or the other?
DA
The code above that goes in bp-custom.php blocks only buddypress specific pages from being viewed by logged out visitors. The plugin should block the wp post and pages. the bp-custom.php with the code and the plugin can be used together to block everything from logged out visitors.