Available from version 1.4.0
Occurs when the software receives a request to log out
Define function:
public static function onUserLogout( &$user ) { ... }
Attach hook:

In extension.json:

	"Hooks": {
		"UserLogout": "MyExtensionHooks::onUserLogout"

For MediaWiki ≤1.25:

$wgHooks['UserLogout'][] = 'MyExtensionHooks::onUserLogout';
Called from:File(s): specials/SpecialUserlogout.php

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


  • $user: the user object that is about to be logged out
  • The function called must return true/false, otherwise a MWException is thrown.

See alsoEdit