0

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 enter image description here

2

You can probably use $wgDefaultUserOptions['rememberpassword'] = 1. See $wgDefaultUserOptions (and also $wgHiddenPrefs).

|improve this answer|||||
4

(MediaWiki 1.31.0) Add to LocalSettings.php:

$wgHooks['AuthChangeFormFields'][] = function ($requests, $fieldInfo, &$formDescriptor, $action) {
  $formDescriptor['rememberMe']['default'] = true;
  return true;
};

See Hooks/AuthChangeFormFields and HTMLForm.

|improve this answer|||||
  • That looks like it might work. Where did you get this code? Can you link to a source or to documentation from which you pieced to together? – Stephen Ostermiller Jul 4 '18 at 16:53
1

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;
};
|improve this answer|||||

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.