XF 1.5 Require Login if not "stay logged in"

MDaly

Member
For users that "stay logged in", I want them to go to the home page, anyone not logged in should be prompted with the Login modal below (same as Login Bar but in modal form). Esp like this one because it shows a muted version of the home page under the login. I've been scouring the forum but just not putting the right pieces together on how to achieve this. Thanks to anyone that can assist!

pmlogin (Small).webp
 
You can try something like this in your template:

Code:
<xen:if is="!{$visitor.user_id}">
    <a href="{xen:link login}" id="TriggerLoginModal" class="inner OverlayTrigger" data-cacheoverlay="false" style="display: none"></a>
    <script>$('#TriggerLoginModal').click()</script>
</xen:if>

hasn't been tested, but should work
 
You can try something like this in your template:

Code:
<xen:if is="!{$visitor.user_id}">
    <a href="{xen:link login}" id="TriggerLoginModal" class="inner OverlayTrigger" data-cacheoverlay="false" style="display: none"></a>
    <script>$('#TriggerLoginModal').click()</script>
</xen:if>

hasn't been tested, but should work

Thank you for the code. Silly question....Not sure which template so I put it in several master style and UIX login helper forms with no luck. Which template should it be in?
 
Back
Top Bottom