Manual:Hooks/UserSaveOptions

UserSaveOptions
Available from version 1.16.0
Removed in version 1.38.0 (Gerrit change 723014)
Called just before saving user preferences. Hook handlers can either add or manipulate options, or reset one back to its default to block changing it. Hook handlers are also allowed to abort the process by returning false, e.g. to save to a global profile instead. Compare to the UserSaveSettings hook, which is called after the preferences have been saved.
Define function:
public static function onUserSaveOptions( User $user, array &$options ) { ... }
Attach hook: In extension.json:
{
	"Hooks": {
		"UserSaveOptions": "MediaWiki\\Extension\\MyExtension\\Hooks::onUserSaveOptions"
	}
}
Called from: File(s): User.php
Interface: UserSaveOptionsHook.php

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

Details

edit
  • $user: The User for which the options are going to be saved
  • &$options: The users options as an associative array, modifiable

See also

edit