How to auto (default) check "Always stay logged in" option ?

Started by RandomDude, August 07, 2011, 11:19:55 AM

Previous topic - Next topic

RandomDude

Hi, I would like to have the "Always stay logged in" option checked by the default for all of my forum users. How do I do that?


Thanks !

Sir Osis of Liver

In Login.template.php find this:



<dd><input type="checkbox" name="cookieneverexp"', $context['never_expire'] ? ' checked="checked"' : '', ' class="input_check" onclick="this.form.cookielength.disabled = this.checked;"  /></dd>';




Change to this:



<dd><input type="checkbox" name="cookieneverexp"', $context['never_expire'] ? ' checked="checked"' : '', ' class="input_check" onclick="this.form.cookielength.disabled = this.checked;" checked="yes" /></dd>';




Ashes and diamonds, foe and friend,
 we were all equal in the end.

                                     - R. Waters

RandomDude

Hey, thanks for your respond!

I'm using the Insidious theme ->http://www.simplemachines.org/community/index.php?topic=443408.0 and it has no Login.template.php file.

However, I found this in index.template.php of Insidious template:

    else
{
echo sprintf($txt['welcome_guest'], $txt['guest_title']);
echo '
  <script language="JavaScript" type="text/javascript" src="', $settings['default_theme_url'], '/scripts/sha1.js"></script>
  <form action="', $scripturl, '?action=login2" method="post" accept-charset="', $context['character_set'], '" style="margin: 4px 0;"', empty($context['disable_login_hashing']) ? ' onsubmit="hashLoginPassword(this, \'' . $context['session_id'] . '\');"' : '', '>
<input type="text" name="user" class="userlog"  size="10" />
<input type="password" name="passwrd" class="userlog"  size="10" />
<input type="submit" value="', $txt['login'], '" class="button_submit" />
<input type="hidden" name="hash_passwrd" value="" />
</form>', $context['current_time'],'<br />';
  }
  echo '
  </div>';


That is the main login section of the template, located in the top left corner. I guess I should do something here, right? Sorry, PHP is not my area.





desibees



I'm the.. Help abuser


RandomDude

Quote from: desibees on August 07, 2011, 06:13:10 PM
Try finding it at Themes/Default/Login.template.php

I already did, but I don't really get it. I mean, how should I use login.template.php from the theme (default) that I do not use to help me with another theme (Insidious)? I might as well delete the default one since I'm not using it, it doesn't matter.

desibees

This is exactly where your misunderstanding.

"Default" is not the name of a theme like "Insidious"
"Default" means the theme you are currently using. In this case, Insidious if your default theme.

Any changes you make to the "Default" theme folder, it will effect any theme you are currently using as default.

Do not delete the Default theme folder.


I'm the.. Help abuser


Illori

Quote from: desibees on August 07, 2011, 06:37:54 PM
This is exactly where your misunderstanding.

"Default" is not the name of a theme like "Insidious"
"Default" means the theme you are currently using. In this case, Insidious if your default theme.

Any changes you make to the "Default" theme folder, it will effect any theme you are currently using as default.

Do not delete the Default theme folder.

not _any_ change to the default themes files will affect all themes that are installed. it depends on how the theme is coded and what files are specific to that theme.

RandomDude

Quote from: desibees on August 07, 2011, 06:37:54 PM
This is exactly where your misunderstanding.

"Default" is not the name of a theme like "Insidious"
"Default" means the theme you are currently using. In this case, Insidious if your default theme.

Any changes you make to the "Default" theme folder, it will effect any theme you are currently using as default.

Do not delete the Default theme folder.

You are wrong here, my friend. :) As Illori already said, every theme acts for itself. "Core" and "Default" are default SMF2 themes.   

desibees

As far as I know, Making that change (as requested in OP) in Default/login.template.php will effect the overall look of Insidious theme.


I'm the.. Help abuser


Illori

yes in that case most likely, but not all template/css changes in the default theme will apply to all themes.

desibees



I'm the.. Help abuser


Illori


desibees

Quote from: Illori on August 07, 2011, 08:47:46 PM
that is up to the op to decide

Yea ^^ i was actually asking him - so you can mark this topic as solved.  ;D


I'm the.. Help abuser


Sir Osis of Liver

WTF?

If a theme does not have a Login.template.php. it will use the template file in /Themes/default (that's why it's called 'default').

To answer your other question, the header login, which is in index.template.php, usually (not always) defaults to a session length of 'Forever'.  You can code it to always default to forever.  If you need that, let me know and I'll dig it up.

Ashes and diamonds, foe and friend,
 we were all equal in the end.

                                     - R. Waters

desibees

Quote from: Krash. on August 07, 2011, 09:59:20 PM
If a theme does not have a Login.template.php. it will use the template file in /Themes/default (that's why it's called 'default').

Exactly what I was saying. Thanks Krash.


I'm the.. Help abuser


RandomDude

Quote from: Krash. on August 07, 2011, 09:59:20 PM
WTF?

If a theme does not have a Login.template.php. it will use the template file in /Themes/default (that's why it's called 'default').

To answer your other question, the header login, which is in index.template.php, usually (not always) defaults to a session length of 'Forever'.  You can code it to always default to forever.  If you need that, let me know and I'll dig it up.

:o Indeed, it works now! Thanks! :D Oh and, apologies to desibees. ;) 

Now, I could also use the same thing for the header login, I would really appreciate your instructions, Krash. :)

Sir Osis of Liver




// Otherwise they're a guest - this time ask them to either register or login
/// Set 'cookielength' to '-1' in hidden input to login Forever
else
{
echo sprintf($txt['welcome_guest'], $txt['guest_title']);
echo '
  <script language="JavaScript" type="text/javascript" src="', $settings['default_theme_url'], '/scripts/sha1.js"></script>
  <form action="', $scripturl, '?action=login2" method="post" accept-charset="', $context['character_set'], '" style="margin: 4px 0;"', empty($context['disable_login_hashing']) ? ' onsubmit="hashLoginPassword(this, \'' . $context['session_id'] . '\');"' : '', '>
<input type="text" name="user" class="userlog"  size="10" />
<input type="password" name="passwrd" class="userlog"  size="10" />
<input type="submit" value="', $txt['login'], '" class="button_submit" />
<input type="hidden" name="hash_passwrd" value="" />
<input type="hidden" name="cookielength" value="-1" />
</form>', $context['current_time'],'<br />';
  }

Ashes and diamonds, foe and friend,
 we were all equal in the end.

                                     - R. Waters

RandomDude


Advertisement: