Skip to:
Content
Pages
Categories
Search
Top
Bottom

Restricted Access


  • Cidade Sonho
    Participant

    @somdefabrica

    Hello BuddyPress friends, I managed to get restricted in my social network.

    The only problem is by sharing links on social networks, the targets appear with the page data lockdown.

    We Can solve that simple conflict?

    http://www.cidadesonho.com/

    BP – 1.6.5
    WP – 3.5.1

Viewing 3 replies - 1 through 3 (of 3 total)

  • Cidade Sonho
    Participant

    @somdefabrica

    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


    Cidade Sonho
    Participant

    @somdefabrica

    From Brazil <3 Thanks for hard work!


    Cidade Sonho
    Participant

    @somdefabrica

    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 😉

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Restricted Access’ is closed to new replies.
Skip to toolbar