Manual:Hooks/UserSetCookies
From Linux Web Expert
File:OOjs UI icon alert-destructive.svg | <translate> This feature was removed completely in version <tvar name=ver>1.40.0</tvar> (after being deprecated in <tvar name=4>1.27.0</tvar>).</translate>
Session-handling extensions should generally be creating a custom subclass of MediaWiki\Session\CookieSessionProvider . Other extensions messing with cookies can no longer count on user data being saved in cookies versus other methods. |
UserSetCookies | |
---|---|
<translate> Available from <tvar name=1><translate> version <tvar </tvar></translate> <translate> Removed in <tvar name=1><translate> version <tvar (Gerrit change 861504)</tvar></translate> Called when setting user cookies | |
<translate> Define function:</translate> | public static function onUserSetCookies( User $user, array &$session, array &$cookies ) { ... }
|
<translate> Attach hook:</translate> | <translate> In <tvar name=1>extension.json</tvar>:</translate>
{
"Hooks": {
"UserSetCookies": "MediaWiki\\Extension\\MyExtension\\Hooks::onUserSetCookies"
}
}
|
<translate> Called from:</translate> | <translate> File(s):</translate> session/CookieSessionProvider.php <translate> Function(s):</translate> persistSession |
<translate> Interface:</translate> | UserSetCookiesHook.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:UserSetCookies extensions</tvar>.</translate>
Details
$user
: User object&$session
: session array, will be added to$_SESSION
&$cookies
: cookies array mapping cookie name to its value