Can you force (or at least prompt) new users to keep themselves logged in?
In order to reduce the likelihood of losing work, I would like the Special:UserLogin page to appear as
Can you force (or at least prompt) new users to keep themselves logged in?
In order to reduce the likelihood of losing work, I would like the Special:UserLogin page to appear as
You can probably use $wgDefaultUserOptions['rememberpassword'] = 1
. See $wgDefaultUserOptions (and also $wgHiddenPrefs).
(MediaWiki 1.31.0, edited 2020) Add to LocalSettings.php:
$wgHooks['AuthChangeFormFields'][] = function ($requests, $fieldInfo, &$formDescriptor, $action) {
$formDescriptor['rememberMe'] = ['type' => 'check', 'default' => true];
return true;
};
See Hooks/AuthChangeFormFields and HTMLForm.
The above answer will now throw fatal exception on Special:CreateAccount if anybody attempts account creation. You have to define the HTML form class. Something like this:
// Check the password "remember me" box by default (sitewide)
$wgHooks['AuthChangeFormFields'][] = function ($requests, $fieldInfo, &$formDescriptor, $action) {
$formDescriptor['rememberMe'] = ['type' => 'check', 'default' => true ];
return true;
};