Viewing 5 posts - 1 through 5 (of 5 total)
  • Question

    #41616
    @debrascott3491

    I had implemented a “walled garden” approach to redirect logged in and logged out visitors to various pages. It works in the preview theme we were using, but doesn’t in Boss.

    Is there something I need to alter in this code to make it work in Boss?

    Here’s what I have in my functions.php file

    //Redirect logged out users to home page & logged-in users to welcome page
    function sh_walled_garden()
    {
    global $bp;
    
    if( is_user_logged_in() && is_front_page() )
    bp_core_redirect( $bp->root_domain . '/welcome/' );
    
    if ( bp_is_register_page() || bp_is_activation_page() || is_page( 'terms-of-service' ) || is_front_page() || is_page( 'privacy-policy' ) || is_page( 'weekly-coaching-checkout' ) || is_page( 'daily-coaching-checkout' ) || is_page( 'accountability-group-membership-checkout' ) || is_page( 'welcome') || is_page( 'sign-up' ) || is_page( 'new-member-login' ) || is_page( 'specialty-group-checkout' ) || is_page( 'upgrades' ) )
    return;
    
    if(! is_user_logged_in() )
    bp_core_redirect( $bp->root_domain );
    }
    
    add_action( 'walled_garden', 'sh_walled_garden' );

    Thank you!

    Answers

    #41655

    Alyssa
    Participant
    @alyssa-buddyboss

    @debrascott3491 When you say preview theme are you talking about TwentyFifteen or something, or is this custom to the host you are on? What happens when you attempt to use this code with the Boss theme?

    A simpler solution could be the plugin s2member. It’s great for doing stuff like this and you can even have a custom menu for logged out users.

    #41660
    @debrascott3491

    Thanks, TJ! The last theme was Enfold. It also worked on TwentyFifteen. In Boss, the redirects just don’t work. There are no errors or anything like that.

    I’m already using the role plugin for setting up roles, so I’d rather not use another membership plugin unless it’s necessary.

    Here’s the thread on the BuddyPress site that outlines this technique, in case that helps.
    https://buddypress.org/support/topic/members-privacy-how-can-i-hide-members-profiles/?topic_page=2&num=15/#post-102784

    Thank you!

    #41709

    Alyssa
    Participant
    @alyssa-buddyboss

    @debrascott3491 email a description of the issue and admin credentials to your site to [email protected] and Varun will look into this further.

    #41743
    @debrascott3491

    Ok, we sent that off. Thank you!

Viewing 5 posts - 1 through 5 (of 5 total)
  • The question ‘Walled Garden?’ is closed to new replies.