Jump to content

Manual:Hooks/UserSetCookies

From mediawiki.org
UserSetCookies
Available from version 1.13.0
Removed in version 1.40.0 (Gerrit change 861504)
Called when setting user cookies
Define function:
public static function onUserSetCookies( User $user, array &$session, array &$cookies ) { ... }
Attach hook: In extension.json:
{
	"Hooks": {
		"UserSetCookies": "MediaWiki\\Extension\\MyExtension\\Hooks::onUserSetCookies"
	}
}
Called from: File(s): session/CookieSessionProvider.php
Function(s): persistSession
Interface: UserSetCookiesHook.php

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


Details

[edit]
  • $user: User object
  • &$session: session array, will be added to $_SESSION
  • &$cookies: cookies array mapping cookie name to its value