Manual:Hooks/SavePreferences

SavePreferences
Available from version 1.11.0
Removed in version 1.16.0
called at the end of PreferencesForm::savePreferences(); returning false prevents the preferences from being saved.
Define function:
public static function onSavePreferences( $form, $user, &$message, $old ) { ... }
Attach hook: In extension.json:
{
	"Hooks": {
		"SavePreferences": "MediaWiki\\Extension\\MyExtension\\Hooks::onSavePreferences"
	}
}
Called from: File(s): SpecialPreferences.php
Interface: SavePreferencesHook.php

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


Details

edit
  • $form: the PreferencesForm
  • $user: the User object to save preferences to
  • &$message: change this to set an error message (ignored if the hook does not return false)
  • $old: array of old options (added in 1.13)