XF 2.0 Login -> Accessed from?

Sanlei

Member
We are using an customized login process to log users both in the forum and authenticate them on our site as well.
This works well, but it needs our own login link to access forum/login, so we changed all links in the forum.

However there are still sites in the forum like /watched/threads and others that are just including the default login form from the template "login".

I want to include a check there to not enabling this form unless the user directly accesses it from /login/.

So something like

Code:
<xf:if is="currentsite != '/login/'">
         <button href="real login page">Login</button>
    <xf:else />
        ...default loginform...
</xf:if>

I thought i could use the $template variable for that, but it doesnt seem to work in this template and i guess it would also just return the login form?
Also is there a list with the global variables for xF2?

Ofc i could just check the URL via JS, but it would be better to check it directly and not on usersite as im guessing there is a way to know the current page the visitor accesses.

Thanks in advance.
 
Last edited:
Also found the $page variable and this doesnt work either.

Anyway i solved it by checking the error-message directly:
Code:
<xf:if is="{$error} == 'You must be logged-in to do that.'">
    <xf:button href="Real Login Page">Login</xf:button>
    <xf:else/>
        ...show login form...
</xf:if>

I think this is good enough in my case, but dunno, if there other types of embedded logins/register besides that 'You must be logged-in to do that.' Use Case.
So i would still prefer a better solution if anyone has an idea.
 
Back
Top Bottom