XF 2.1 How to customise the login template to remove the generic logged out error on a single URL?

RobinHood

Well-known member
My entire site is private, so I've revoked the general 'View' permission for unregistered / unconfirmed.

This means that every page creates a login page with the "You must be logged-in to do that.'' error.

That's fine, but I want to remove that error for the site index URL so I can customise the login template when loaded at the index URL with a new design to encourage people to sign up.

The install is at:

domain.com/hq/

The forum is at domain.com/hq/forums/

I've created an XF page as a landing page and set that as the index page route to it appears at domain.com/hq/ when you login.

I need some kind of conditional for the login template to display differently on the site index at domain.com/hq/

First of all, is this even possible seeing as I've revoked the view permission sitewide for logged out users?

I've tried

Code:
<xf:if is="$xf.fullUri == $xf.options.boardUrl">
Some content
</xf:if>

This works, but I have to add a trailing slash to the board URL in the ACP and it says not to.

Is there away around this by creating another template variable I can reference?

I've also tried using the page node ID I'm using for the index as follows, but that doesn't work

Code:
<xf:if is="$forum.node_id == 43">
Show content..
</xf:if>

Or any other ideas?
 
I think I figured it out. Just made a few local variables for the site index and matched them up with the $xf.fullUri variable

Code:
<xf:set var="$dashboard_www" value="https://www.domain.co.uk/hq/" />
<xf:set var="$dashboard_nonwww" value="https://domain.co.uk/hq/" />


<xf:if is="$xf.fullUri == $dashboard_www || $xf.fullUri == $dashboard_nonwww">
Show content
</xf:if>
 
Last edited:
It was simpler to just use $xf.uri, so this is a bit tidier:

Code:
<xf:set var="$dashboardUri" value="/hq/" />



<xf:if is="$xf.uri != $dashboardUri">

    <xf:title>{{ phrase('log_in') }}</xf:title>

<xf:else />

    <xf:title>{{ phrase('log_in') }} or Register</xf:title>

</xf:if>
 
Top Bottom