From: Alexandre Emsenhuber Date: Sat, 12 Apr 2008 19:42:27 +0000 (+0000) Subject: Added parameter to SavePreferences hook, contains old user preferences. See my next... X-Git-Tag: 1.31.0-rc.0~48404 X-Git-Url: https://git.cyclocoop.org/%7B%24www_url%7Dadmin/compta/comptes/ajouter.php?a=commitdiff_plain;h=c27b4b7b627b265f34d7d9de4e60b3cb0198a2f0;p=lhc%2Fweb%2Fwiklou.git Added parameter to SavePreferences hook, contains old user preferences. See my next commit for an implementation of it. --- diff --git a/docs/hooks.txt b/docs/hooks.txt index c8856bf632..42ee77f83c 100644 --- a/docs/hooks.txt +++ b/docs/hooks.txt @@ -912,7 +912,8 @@ $user: the User object to load preferences from returning false prevents the preferences from being saved. $form: the PreferencesForm $user: the User object to save preferences to -$message: change this to set an error message (ignored if the hook does notreturn fals) +$message: change this to set an error message (ignored if the hook does not return false) +$old: old preferences of the user 'SearchUpdate': Prior to search update completion $id : Page id diff --git a/includes/SpecialPreferences.php b/includes/SpecialPreferences.php index 57e973f8b5..46c0eac09c 100644 --- a/includes/SpecialPreferences.php +++ b/includes/SpecialPreferences.php @@ -236,6 +236,7 @@ class PreferencesForm { } } $wgUser->setRealName( $this->mRealName ); + $oldOptions = $wgUser->mOptions; if( $wgUser->getOption( 'language' ) !== $this->mUserLanguage ) { $needRedirect = true; @@ -336,13 +337,13 @@ class PreferencesForm { } } - if (!$wgAuth->updateExternalDB($wgUser)) { + if( !$wgAuth->updateExternalDB( $wgUser ) ){ $this->mainPrefsForm( 'error', wfMsg( 'externaldberror' ) ); return; } $msg = ''; - if ( !wfRunHooks( 'SavePreferences', array( $this, $wgUser, &$msg ) ) ) { + if ( !wfRunHooks( 'SavePreferences', array( $this, $wgUser, &$msg, $oldOptions ) ) ) { $this->mainPrefsForm( 'error', $msg ); return; } @@ -352,7 +353,7 @@ class PreferencesForm { if( $needRedirect && $error === false ) { $title = SpecialPage::getTitleFor( 'Preferences' ); - $wgOut->redirect($title->getFullURL('success')); + $wgOut->redirect( $title->getFullURL( 'success' ) ); return; }