Re: redirect – if not logged in – for some sections
There is an epic thread on this that is worth a read – https://buddypress.org/community/groups/creating-extending/forum/topic/securing-components-from-non-logged-in-users/
That thread has lots of examples and discussion.
Here’s an example:
`
function restrict_access(){
global $bp, $bp_unfiltered_uri;
if (!is_user_logged_in() &&
(
BP_MEMBERS_SLUG == $bp_unfiltered_uri[0] ||
BP_GROUPS_SLUG == $bp->current_component ||
BP_BLOGS_SLUG == $bp->current_component ||
‘forums’ == $bp->current_component ||
is_page_template(‘private-page.php’)
)
) {
bp_core_redirect( get_option(‘home’) . “/private/” );
}
}
add_action( ‘wp’, ‘restrict_access’, 3 );
`
You can put that in bp-custom.php in the `wp-content/plugins/` directory. https://codex.buddypress.org/extending-buddypress/bp-custom-php/