Manual:Hooks/LoginFormValidErrorMessages

From Linux Web Expert

LoginFormValidErrorMessages
<translate> Available from <tvar name=1><translate> version <tvar (Gerrit change 170520)</tvar></translate>
Allows to add message keys accepted in the warning url parameter on redirects to Special:UserLogin.
<translate> Define function:</translate>
public static function onLoginFormValidErrorMessages( &$messages ) { ... }
<translate> Attach hook:</translate> <translate> In <tvar name=1>extension.json</tvar>:</translate>
{
	"Hooks": {
		"LoginFormValidErrorMessages": "MediaWiki\\Extension\\MyExtension\\Hooks::onLoginFormValidErrorMessages"
	}
}
<translate> Called from:</translate> <translate> File(s):</translate> specials/helpers/LoginHelper.php
<translate> Interface:</translate> LoginFormValidErrorMessagesHook.php

<translate> For more information about attaching hooks, see <tvar name=1>Manual:Hooks </tvar>.</translate>
<translate> For examples of extensions using this hook, see <tvar name=cat>Category:LoginFormValidErrorMessages extensions</tvar>.</translate>

Details

  • &$messages: Array of messages already added.

Allows to add additional error messages to be accepted in the warning parameter on redirects to Special:UserLogin. The message given in the url parameter is supposed to state why the user should log in. This allows extensions to add further purposes in addition to the message keys already specified in LoginForm::$validErrorMessages.