Manual:Hooks/LoginFormValidErrorMessages

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

For more information about attaching hooks, see Manual:Hooks .
For examples of extensions using this hook, see Category:LoginFormValidErrorMessages extensions.

Details edit

  • &$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.