BuddyBoss Home – Web › Support Forums › Themes › Boss. theme › Walled Garden?
Tagged: redirect, restrict access, walled garden
- This topic has 4 replies, 2 contibutors, and was last updated 9 years, 4 months ago by Debra.
Question
June 24, 2015 at 5:48 pm #41616@debrascott3491I 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
June 25, 2015 at 9:53 am #41655@alyssa-buddyboss
AlyssaParticipant@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.
June 25, 2015 at 10:32 am #41660@debrascott3491Thanks, 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-102784Thank you!
June 26, 2015 at 10:15 am #41709@alyssa-buddyboss
AlyssaParticipant@debrascott3491 email a description of the issue and admin credentials to your site to [email protected] and Varun will look into this further.
June 26, 2015 at 5:00 pm #41743@debrascott3491Ok, we sent that off. Thank you!
- The question ‘Walled Garden?’ is closed to new replies.