Manual:Hooks/UserResetAllOptions

From Linux Web Expert

UserResetAllOptions
<translate> Available from <tvar name=1><translate> version <tvar (Gerrit change 144689)</tvar></translate>
<translate> Removed in <tvar name=1><translate> version <tvar (Gerrit change 723014)</tvar></translate>
Allows changing the behavior when a user's preferences are reset. For instance, certain preferences can be preserved.
<translate> Define function:</translate>
public static function onUserResetAllOptions( User $user, array &$newOptions, array $oldOptions, $resetKinds ] ); ) { ... }
<translate> Attach hook:</translate> <translate> In <tvar name=1>extension.json</tvar>:</translate>
{
	"Hooks": {
		"UserResetAllOptions": "MediaWiki\\Extension\\MyExtension\\Hooks::onUserResetAllOptions"
	}
}
<translate> Called from:</translate> <translate> File(s):</translate> User.php
<translate> Function(s):</translate> User::resetOptions
<translate> Interface:</translate> UserResetAllOptionsHook.php

<translate> For more information about attaching hooks, see <tvar name=1>Manual:Hooks </tvar>.</translate>
<translate> For examples of extensions using this hook, see <tvar name=cat>Category:UserResetAllOptions extensions</tvar>.</translate>

Details

  • 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.