Manual:Hooks/LoginUserMigrated

From MediaWiki.org
Jump to navigation Jump to search
LoginUserMigrated
Available from version 1.26.0
Removed in version 1.33.0
allows extensions to inform a user that their username doesn't exist for a specific reason
Define function:
public static function onLoginUserMigrated( User $user, &$msg ) { ... }
Attach hook:

In extension.json:

{
	"Hooks": {
		"LoginUserMigrated": "MyExtensionHooks::onLoginUserMigrated"
	}
}

For MediaWiki ≤1.25:

$wgHooks['LoginUserMigrated'][] = 'MyExtensionHooks::onLoginUserMigrated';
Called from:File(s): user/User.php

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

Details[edit]

This allows providing a reason to the user why their username doesn't exist, instead of letting the login form give the generic error message that the account does not exist. For example, when the account has been renamed or deleted.

  • $user: The User object being authenticated against.
  • &$msg: The message identifier for abort reason, or an array to pass a message key and parameters.