BuddyBoss Home – Web › Support Forums › Themes › Boss. theme › Different homepage if not logged
- This topic has 6 replies, 4 contibutors, and was last updated 8 years, 9 months ago by Anonymous.
Question
December 3, 2015 at 10:00 am #53597@virginiofanelliHello,
I’m looking for a plugin that will display a basic homepage for a visitor and a special homepage when the visitor is logged.
Thanks for your help
VirginioAnswers
December 3, 2015 at 10:19 am #53599@virginiofanelliOk i found a solution so if it can help :
Place this code in the functions.php
function bpfr_guest_redirect() { global $bp; // enter the slug or component conditional here if ( is_home() || is_front_page()|| bp_is_activity_component() || bp_is_groups_component() || bp_is_blogs_component() || bp_is_page( BP_MEMBERS_SLUG ) || is_bbpress() ) { // not logged in user - user will be redirect to any link to want if( !is_user_logged_in() ) { //wp_redirect( get_option('siteurl') ); //back to homepage //wp_redirect( get_option('siteurl') . '/register' ); // back to register page wp_redirect( get_option('siteurl') . '/public' ); // back to whatever page } } } add_filter('get_header','bpfr_guest_redirect',1); ?>
Make a template page with the name public and it works fine.
December 3, 2015 at 1:37 pm #53620@
Anonymous🙂 Glad , Thanks for your input
It will help to other who will try same approach.
Regards
Varun DubeyFebruary 8, 2016 at 10:22 pm #58584@bryceevans@virginiofanelli or @vapvarun – for the solution above, sorry if this is obvious, but what should the /public page be for? Is that the homepage for non-members?
And then the WordPress homepage is set to the one for members?
February 9, 2016 at 2:05 am #58588@
AnonymousHi @bryceevans,
You can keep homepage as landing page for logout users and redirect all members on a specific page which have slug “public” after login or to their profile page.or
You can simply use S2 members plugin for better control
Regards
Varun DubeyFebruary 11, 2016 at 9:03 pm #58974@bryceevansHi @vapvarun – sorry if this is an obvious question, but I’ve tried searching and can’t find the answer.
If I’m already using S2Member, how would I control the different home pages for logged in / out users?
February 14, 2016 at 11:47 pm #59212@
AnonymousHi @bryceevans, In S2member’s settings there is an Restriction option for post and page access and in the individual page you can also set it according to the user level..
s2Member’s Membership Options Page is always unrestricted, and even setting your entire site to be restricted won’t change that. This is the Page that Users are sent to when they attempt to access restricted content. You can use that to your advantage.
For example, setting any field within Dashboard -> s2Member -> Restriction Options -> URI Restrictions field to / in your Dashboard will prevent any URL within WordPress on your site from being accessed without a User at least being registered and logged-in on your site.
Similarly, you can use the keyword all within the Post and Page Restrictions section to block access to all Posts/Pages (with the Membership Options Page being an exception).
- The question ‘Different homepage if not logged’ is closed to new replies.