< Manual:Hooks 
 
      |  | This deprecated feature should no longer be used, but is still available for reasons of backwards compatibility.
This feature was deprecated in version 1.27.0. 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 | |
|---|---|
| Available from version 1.13.0 Called when setting user cookies | |
| Define function: | public static function onUserSetCookies( User $user, array &$session, array &$cookies ) { ... }
 | 
| Attach hook: | In extension.json: {
	"Hooks": {
		"UserSetCookies": "MyExtensionHooks::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
- $user: User object
- &$session: session array, will be added to- $_SESSION
- &$cookies: cookies array mapping cookie name to its value
    This article is issued from Mediawiki. The text is licensed under Creative Commons - Attribution - Sharealike. Additional terms may apply for the media files.