Skip to:
Content
Pages
Categories
Search
Top
Bottom

Reply To: Restrict member profile views to logged in users

@shanebp

Moderator

Put this in the functions.php file in your child theme or in bp-custom.php
It will redirect visitors to the home page if they are not logged in and they try to open a member profile or the members directory.

function seaspray_restrict_members() {

	if ( bp_is_user() || bp_is_members_directory() ) {

		if ( ! is_user_logged_in() ) {

			wp_safe_redirect( home_url() );

			die();
		}
	}
}
add_action( 'bp_ready', 'seaspray_restrict_members' );
Skip to toolbar