I am trying to restrict nonmembers to just the login page as it is on the demo but not sure how i can do that i tried the option on the FAQ but not working.
Option tired ::::
/**
* Redirect buddypress pages to registration page
*/
function gwangi_restrict_buddypress() {
// If not logged in and on a bp page except registration or activation
if ( ! is_user_logged_in() && is_buddypress() && ! bp_is_blog_page() && ! bp_is_activation_page() && ! bp_is_register_page() ) {
wp_redirect( home_url( ‘/register/’ ) );
exit();
Please i need responds as soon as possible
}
}
add_action( ‘template_redirect’, ‘gwangi_restrict_buddypress’ );