Manual:Hooks/UserResetAllOptions

From MediaWiki.org
Jump to navigation Jump to search

Other languages:
English • ‎français • ‎polski
UserResetAllOptions
Available from version 1.24.0 (Gerrit change 144689)
Allows changing the behavior when a user's preferences are reset. For instance, certain preferences can be preserved.
Define function:
public static function onUserResetAllOptions( User $user, array &$newOptions, array $oldOptions, $resetKinds ] ); ) { ... }
Attach hook:

In extension.json:

{
	"Hooks": {
		"UserResetAllOptions": "MyExtensionHooks::onUserResetAllOptions"
	}
}

For MediaWiki ≤1.25:

$wgHooks['UserResetAllOptions'][] = 'MyExtensionHooks::onUserResetAllOptions';
Called from:File(s): User.php
Function(s): User::resetOptions

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

Details[edit]

  • User $user: User whose preferences are being reset.
  • array &$newOptions: New preferences as associative array.
  • array $oldOptions: Old preferences as associative array.
  • array|string resetKinds: Kinds of preferences to reset as an array or string; see User::resetOptions for possible values.