XF 2.2 External login

Korsch

Member
Im looking for little insight and guidance into a project im working on, Im using the Xenforo Homepage add-on and im trying to set it up as a landing page with some links. For example if a user has not been logged in or isn't registered they are presented with Forums, Login, and Register. If a user has been logged in already they're presented with Forums, Account and Logout.

Ive worked it out so all links are working as intended, but I want to streamline the whole thing by having the login link presenting the user with the Login Overlay that would be presented within the forum.
HTML:
<div class="user-links">
            <xf:if is="{$xf.visitor.user_id}">
                <a href="{{ link('forums', '', { 'csrf': 'true' }) }}">Forums</a> |
                <a href="{{ link('account') }}">Account</a> |
                <a href="{{ link('logout', null, {'t': csrf_token()}) }}" class="menu-linkRow">{{ phrase('log_out') }}</a>
            <xf:else />
                <a href="{{ link('forums', '', { 'csrf': 'true' }) }}">Forums</a> |
                <a href="{{ link('login') }}">Log In</a> |
                <a href="{{ link('register') }}">Register</a>
            </xf:if>

Currently this is what my homepage links look like now, ive tried a few options like adding the login javascript file ( /js/xf/login_signup.js )
with
HTML:
<a id="custom-login-link" href="#" class="button">Login</a>
and
JavaScript:
<script>
  document.getElementById('custom-login-link').addEventListener('click', function(e) {
    e.preventDefault();
    XF.login();
  });
</script>
with no luck. so I guess my next question is if this is really possible?

Thanks everyone!
 
You can open content as an overlay by adding the data-xf-click attribute to your HTML tag:
HTML:
<a href="{{ link('login') }}" data-xf-click="overlay">Log In</a>
 
You can open content as an overlay by adding the data-xf-click attribute to your HTML tag:
HTML:
<a href="{{ link('login') }}" data-xf-click="overlay">Log In</a>
This just opens the login page as a regular link taking users to https://domain/login/ and not opening any overlay,
I’m still optimistic being that the homepage addon is still within the Xenforo environment, I imagine its possible but I’m drawing a blank at this point.
 
Last edited:
Top Bottom