BuddyBoss Home – Web Support Forums Themes Boss. theme Different homepage if not logged

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

    #53597
    @virginiofanelli

    Hello,
    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
    Virginio

    Answers

    #53599
    @virginiofanelli

    Ok 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.

    #53620

    Anonymous
    @

    🙂 Glad , Thanks for your input
    It will help to other who will try same approach.
    Regards
    Varun Dubey

    #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?

    #58588

    Anonymous
    @

    Hi @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 Dubey

    #58974
    @bryceevans

    Hi @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?

    #59212

    Anonymous
    @

    Hi @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).

Viewing 7 posts - 1 through 7 (of 7 total)
  • The question ‘Different homepage if not logged’ is closed to new replies.