Manual:Hooks/UserSetCookies

From Linux Web Expert

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