1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

Plain public front for a private site? (resolved)

Discussion in 'XenForo Development Discussions' started by StarRiver, May 9, 2014.

  1. StarRiver

    StarRiver Member

    I'm just starting to set up a site using xenForo for my organization's internal discussions. There will be no public access and registration is all by invitation (i.e. done administratively). I would like the front page of this site to show the usual forum list to registered users who have set cookies for auto-login. For everyone else, I would like the front page to just have a simple message and a place to sign in, like this:

    [​IMG]

    If I try to do this just with permissions (set "View node" to Not Set (No) for guests), I get this:

    [​IMG]

    What I'm aiming for is totally plain – no menus or links, no images, no styling – just plain static html for the message and then the login form.

    I'm comfortable with coding and happy to modify templates to get the result I want, but I'd appreciate some advice from experienced xenForo developers on the best way to approach getting this result.

    Thanks!
     
    Last edited: May 10, 2014
  2. StarRiver

    StarRiver Member

    I think I have it sorted although there may well be a better way.

    I've made the following modifications to the page_container template:

    In the head section, for the page title, I have:
    Code:
        <xen:if is="!{$visitor.user_id}"><title>Internal Work-team Forums</title>
        <xen:else />
        <title><xen:if is="{$title}">{xen:raw $title} | {$xenOptions.boardTitle}<xen:else />{$xenOptions.boardTitle}</xen:if></title>
        </xen:if>
    
    At the start of the body section I test for a logged in user followed by the
    standard body section for page_container:
    Code:
    <body{xen:if {$bodyClasses}, ' class="{$bodyClasses}"'}>
    <xen:hook name="body">
    <xen:if is="{$visitor.user_id}">
    ... rest of the standard body section for page_container down to ...
    <footer>
        <xen:include template="footer" />
    </footer>
    
    <xen:include template="page_container_js_body" />
    
    After the standard body section for page_container I add a stripped down version of that same body section that gives me the simplified login page:
    Code:
    <xen:else />
    <div id="content" class="{$contentTemplate}">
        <div class="pageWidth">
            <div class="pageContent">
                <!-- main content area -->
    
                <!--[if lt IE 8]>
                    <p class="importantMessage">{xen:phrase you_are_using_out_of_date_browser_upgrade}</p>
                <![endif]-->
    
                <!-- main template -->
    
                <form action="login/login" method="post" class="xenForm" id="pageLogin">
    
                    <h2 class="textHeading">Registered users please log in</h2>
    
                    <dl class="ctrlUnit">
                        <dt><label for="ctrl_pageLogin_login">Your name or email address:</label></dt>
                        <dd><input type="text" name="login" value="" id="ctrl_pageLogin_login" class="textCtrl" tabindex="1" /></dd>
                    </dl>
    
    
                    <dl class="ctrlUnit">
                        <dt><label for="ctrl_pageLogin_password">Password:</label></dt>
                        <dd>
                            <input type="password" name="password" class="textCtrl" id="ctrl_pageLogin_password" />                  
                            <div><label for="ctrl_pageLogin_remember" class="rememberPassword"><input type="checkbox" name="remember" value="1" id="ctrl_pageLogin_remember" tabindex="3" /> Stay logged in</label></div>
                        </dd>
                    </dl>
                    <dl class="ctrlUnit submitUnit">
                        <dt></dt>
                        <dd>
                            <input type="submit" class="button primary" value="Log in" data-loginPhrase="Log in" data-signupPhrase="Sign up" tabindex="4" />
                            <a href="lost-password/" class="OverlayTrigger OverlayCloser" tabindex="6">Forgot your password?</a>
                        </dd>
                    </dl>
                    <input type="hidden" name="cookie_check" value="1" />
                    <input type="hidden" name="_xfToken" value="" />
                    <input type="hidden" name="redirect" value="/" />
                </form>
            </div>
        </div>
    </div>
    <xen:include template="page_container_js_body" />
    </xen:if>
    
    The result looks like:

    [​IMG]
     
    Last edited: May 10, 2014

Share This Page