Different static front page for logged in and logged out users

Hello,
I want to have two different static home page for logged in users and logged out or non registered users because I don't want to reveal the price of tours to those who not registered with our site. I somehow managed to achieve this for logged out users thanks to the membership2 plugin, but not quite for the logged in users. See this image shot http://imgur.com/RHi3TaQ I guess it is because I set to front page to "Home" http://imgur.com/263tLny Could you help me not to have this page showing up for logged in users when they click on our logo.
Best,
Austin

  • Vaughan
    • Support/SLS MockingJay

    Hi Austin,

    Are you wanting to be able to use a completely different page for the home page ,so you have 2 different home pages,1 for logged in, another for logged out?

    You couldtry the following:

    Add the following code to your theme functions.php

    add_action('init', 'wpmu_custom_front', 10);
    	function wpmu_custom_front($wp_query) {
    		if(!is_admin()) {
    			if(is_user_logged_in()) {
    				add_filter('pre_option_show_on_front', 'wpmu_show_on_front_filter');
    				add_filter('pre_option_page_on_front', 'wpmu_page_on_front_filter');
    			}
    		}
    	}
    
    	function wpmu_show_on_front_filter($val) { return 'page'; }
    	function wpmu_page_on_front_filter($val) { return is_user_logged_in() ? get_option('page_on_front') : 123; }

    Now assign the home page you want displayed for logged in users in the appearances > reading optionsas the static front page.

    In the code above, add replace the 123 in the last line to the page_id of the page you want to display to logged out users.

    Hope this helps

  • austin
    • Site Builder, Child of Zeus

    Hello Vaughan,
    I was trying to paste the code you gave me to the child theme>functions.php, with replacement of the page (ID 6512) in the 123. But it gave me 500 error so I deleted and I am asking for the help.
    Best,
    Austin

    Following is the code I was trying to paste into child theme functions.php
    add_action('init', 'wpmu_custom_front', 10);
    function wpmu_custom_front($wp_query) {
    if(!is_admin()) {
    if(is_user_logged_in()) {
    add_filter('pre_option_show_on_front', 'wpmu_show_on_front_filter');
    add_filter('pre_option_page_on_front', 'wpmu_page_on_front_filter');
    }
    }
    }

    function wpmu_show_on_front_filter($val) { return 'page'; }
    function wpmu_page_on_front_filter($val) { return is_user_logged_in() ? get_option('page_on_front') : 6512; }for the logged out user

  • Vaughan
    • Support/SLS MockingJay

    Hi austin,

    We could perhaps just display different content to logged in users, using just shortcodes on the page.

    [ms-protect-content id="123,234,555,333"]
    Your content for Logged in users goes here
    [/ms-protect-content]
    
    [ms-protect-content id="123,234,555,333" access="no" silent="yes"]
    Everybody except members of memberships 123,234,555,333 can see this
    [/ms-protect-content]

    Where 123,234,555,333 are the membership id's which you can find on the memberships page in admin

    Dashboard > membership > memberships

    Hope this helps

Thank NAME, for their help.

Let NAME know exactly why they deserved these points.

Gift a custom amount of points.