XF 1.1 How pre-check "stay logged in" in logged in template?

Marcus

Well-known member
How can I pre-check "stay logged in" in the logged in template? It is the checked="checked" html statement.

If not done by css, how would you do that with javascript: with jquery once the user clicks on "register or login" is the best guess, agreed?
 
Yes this is exactly how I have it now. I want a solution that does not change the template. As there is no template hook I could add a javascript to the bottom of all my pages for not logged in users that activates the checked attribute once a user clicks on the "register or login" link. Or it just adds the checked attribute everytime. I don't know if this can be a performance issue.
 
Yes this is exactly how I have it now. I want a solution that does not change the template. As there is no template hook I could add a javascript to the bottom of all my pages for not logged in users that activates the checked attribute once a user clicks on the "register or login" link. Or it just adds the checked attribute everytime. I don't know if this can be a performance issue.

I make it work here, but i dont know, as you said, if this can be a performance issue. But that's it:

PHP:
<?php

class LoginChecked_Listener
{
    public static function template_post_render ($templateName, &$content, array &$containerData, XenForo_Template_Abstract $template)
    {
        if ($templateName == 'PAGE_CONTAINER')
        {
            $content = str_replace('<input type="checkbox" name="remember"', '<input type="checkbox" name="remember" checked="checked" ', $content);
        }
    }
}

?>

Maybe there is another easy way to do it. But works, anyway.
 
I did only see your post now. I have created a javascript that adds the checked attribute to this input field once you click on "register or sign in" in a custom template added after template hook body. All other template hooks in PAGE_CONTAINER are above this field.

It is interesting to know what is the faster approach.
 
Top Bottom