Restrict BuddyPress Members Pages from Non-Logged in Users
The following snippet will redirect non-logged in users when visiting your BuddyPress members area.
<?php
function bp_restrict_members() {
global $bp;
if (bp_is_page( BP_MEMBERS_SLUG ) ) {
if( !is_user_logged_in() ) {
wp_redirect( get_option('siteurl') );
}
}
}
add_filter('get_header', 'bp_restrict_members', 1);
?>
what directory/file would i need to add this code to in order to do that?