Manual:Hooks/UserLoadFromSession
Appearance
This feature was removed from MediaWiki core in version 1.34.0 (after being deprecated in 1.27.0). Please see MediaWiki\Session\SessionProvider for an alternative way to use this feature. |
UserLoadFromSession | |
---|---|
Available from version 1.13.0 Removed in version 1.34.0 (Gerrit change 518326) Called to authenticate users on external/environmental means. | |
Define function: | public static function onUserLoadFromSession( $user, &$result ) { ... }
|
Attach hook: | In extension.json:
{
"Hooks": {
"UserLoadFromSession": "MediaWiki\\Extension\\MyExtension\\Hooks::onUserLoadFromSession"
}
}
|
Called from: | File(s): user/User.php |
Interface: | UserLoadFromSessionHook.php |
For more information about attaching hooks, see Manual:Hooks .
For examples of extensions using this hook, see Category:UserLoadFromSession extensions.
Details
[edit]$user
: User object being loaded&$result
: set this to a boolean value to abort the normal authentication process
This hook replaces AutoAuthenticate, which has been removed in 1.13.
An extension can use this hook to fill in the data of the User object $user from an external session. This is typically used in Authentication extensions.
When the authentication should continue undisturbed after the hook was executed, do not touch $result. When the normal authentication should not happen (e.g., because $user is completely initialized), set $result to any boolean value.
In any case, return true
.
See the talk page for sample code for this hook.