Manual:Hooks/SavePreferences

From MediaWiki.org
Jump to: navigation, search
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:
$wgHooks['SavePreferences'][] = 'MyExtensionHooks::onSavePreferences';
Called from: SpecialPreferences.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)