Manual:Hooks/UserLoggedIn

From MediaWiki.org
Jump to navigation Jump to search
UserLoggedIn
Available from version 1.26.0 (Gerrit change 236043)
Called after a user is logged in
Define function:
public static function onUserLoggedIn( $user ) { ... }
Attach hook:

In extension.json:

{
	"Hooks": {
		"UserLoggedIn": "MyExtensionHooks::onUserLoggedIn"
	}
}

For MediaWiki ≤1.25:

$wgHooks['UserLoggedIn'][] = 'MyExtensionHooks::onUserLoggedIn';
Called from:File(s): specials/SpecialUserLogin.php, auth/AuthManager.php

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

Details[edit]

  • $user: User object for the logged-in user

Notes[edit]

Added in MediaWiki 1.26 as part of the upcoming AuthManager system. Replaces the AuthPlugin::updateUser() method call.

See also[edit]