This is what I use in bp-custom
function bp_displayed_user_is_friend() {
global $bp;
if ( bp_is_profile_component() || bp_is_member() ) {
if ( ('is_friend' != BP_Friends_Friendship::check_is_friend( $bp->loggedin_user->id, $bp->displayed_user->id )) && (bp_loggedin_user_id() != bp_displayed_user_id()) )
if ( !is_super_admin( bp_loggedin_user_id() ) )
return true;
}
than, I add the above code in members/single/home
<?php if ( bp_displayed_user_is_friend() ) : ?>
<?php locate_template( array( 'members/single/not-friend.php' ), true ) ?>
<?php else : ?>
// home
<?php endif ?>
in the end, I make a not-friend.php page for logout users
That’s it! work for me
From Brazil <3 Thanks for hard work!
I forgot the most important code 😡 sorry
This code need must be the first code of your bp-custom.php
add_action( 'wp', 'custom_lockdown_redirect', 3 );
function custom_lockdown_redirect(){
global $wp;
if (!is_user_logged_in()){
if ( bp_is_activation_page()
|| bp_is_register_page()
|| is_page_template( 'template-custom-lockdown.php' )
|| ( in_array( $GLOBALS['pagenow'], array( 'wp-login.php' )))
)
return;
bp_core_redirect(get_option('siteurl') . "/register");
exit;
}
}
Good 😉