MediaWiki master
MediaWiki\User\Options\Hook\SaveUserOptionsHook Interface Reference

This is a hook handler interface, see docs/ More...

Inherited by MediaWiki\HookContainer\HookRunner.

Public Member Functions

 onSaveUserOptions (UserIdentity $user, array &$modifiedOptions, array $originalOptions)
 This hook is called just before saving user preferences.

Detailed Description

This is a hook handler interface, see docs/

Use the hook name "SaveUserOptions" to register handlers implementing this interface.

Stability: stable
to implement

Definition at line 14 of file SaveUserOptionsHook.php.

Member Function Documentation

◆ onSaveUserOptions()

MediaWiki\User\Options\Hook\SaveUserOptionsHook::onSaveUserOptions ( UserIdentity $user,
array & $modifiedOptions,
array $originalOptions )

This hook is 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.

UserIdentity$userThe user for which the options are going to be saved
array&$modifiedOptionsThe user's options as an associative array, modifiable. To reset the preference value to default, set the preference to null. To block the preference from changing, unset the key from the array. To modify a preference value, set a new value.
array$originalOptionsThe user's original options being replaced
bool|void True or no return value to continue or false to abort

Implemented in MediaWiki\HookContainer\HookRunner.

The documentation for this interface was generated from the following file: