Manual:Hooks/UserLogout

From mediawiki.org
Jump to navigation Jump to search
UserLogout
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"
	}
}
Called from:File(s): specials/SpecialUserLogout.php
Interface:UserLogoutHook.php

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

Details[edit]

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

See also[edit]