Index: trunk/phase3/docs/hooks.txt |
— | — | @@ -482,6 +482,10 @@ |
483 | 483 | $imagePage: ImagePage object ($this) |
484 | 484 | $output: $wgOut |
485 | 485 | |
| 486 | +'InitPreferencesForm': called at the end of PreferencesForm's constructor |
| 487 | +$form: the PreferencesForm |
| 488 | +$request: the web request to initialized from |
| 489 | + |
486 | 490 | 'InternalParseBeforeLinks': during Parser's internalParse method before links but |
487 | 491 | after noinclude/includeonly/onlyinclude and other processing. |
488 | 492 | &$this: Parser object |
— | — | @@ -574,6 +578,20 @@ |
575 | 579 | &$obj: RawPage object |
576 | 580 | &$text: The text that's going to be the output |
577 | 581 | |
| 582 | +'RenderPreferencesForm': called at the end of PreferencesForm::mainPrefsForm |
| 583 | +$form: the PreferencesForm |
| 584 | +$out: output page to render to, probably $wgOut |
| 585 | + |
| 586 | +'ResetPreferences': called at the end of PreferencesForm::resetPrefs |
| 587 | +$form: the PreferencesForm |
| 588 | +$user: the User object to load preferences from |
| 589 | + |
| 590 | +'SavePreferences': called at the end of PreferencesForm::savePreferences; |
| 591 | + returning false prevents the preferences from being saved. |
| 592 | +$form: the PreferencesForm |
| 593 | +$user: the User object to save preferences to |
| 594 | +$message: change this to set an error message (ignored if the hook does notreturn fals) |
| 595 | + |
578 | 596 | 'SearchUpdate': Prior to search update completion |
579 | 597 | $id : Page id |
580 | 598 | $namespace : Page namespace |
Index: trunk/phase3/includes/SpecialPreferences.php |
— | — | @@ -97,6 +97,8 @@ |
98 | 98 | if ( !preg_match( '/^[a-z\-]*$/', $this->mUserLanguage ) ) { |
99 | 99 | $this->mUserLanguage = 'nolanguage'; |
100 | 100 | } |
| 101 | + |
| 102 | + wfRunHooks( "InitPreferencesForm", array( $this, $request ) ); |
101 | 103 | } |
102 | 104 | |
103 | 105 | function execute() { |
— | — | @@ -298,9 +300,17 @@ |
299 | 301 | $wgUser->setOption( $tname, $tvalue ); |
300 | 302 | } |
301 | 303 | if (!$wgAuth->updateExternalDB($wgUser)) { |
302 | | - $this->mainPrefsForm( wfMsg( 'externaldberror' ) ); |
| 304 | + $this->mainPrefsForm( 'error', wfMsg( 'externaldberror' ) ); |
303 | 305 | return; |
304 | 306 | } |
| 307 | + |
| 308 | + $msg = ''; |
| 309 | + if ( !wfRunHooks( "SavePreferences", array( $this, $wgUser, &$msg ) ) ) { |
| 310 | + print "(($msg))"; |
| 311 | + $this->mainPrefsForm( 'error', $msg ); |
| 312 | + return; |
| 313 | + } |
| 314 | + |
305 | 315 | $wgUser->setCookies(); |
306 | 316 | $wgUser->saveSettings(); |
307 | 317 | |
— | — | @@ -395,6 +405,8 @@ |
396 | 406 | $this->mSearchNs[$i] = $wgUser->getOption( 'searchNs'.$i ); |
397 | 407 | } |
398 | 408 | } |
| 409 | + |
| 410 | + wfRunHooks( "ResetPreferences", array( $this, $wgUser ) ); |
399 | 411 | } |
400 | 412 | |
401 | 413 | /** |
— | — | @@ -994,6 +1006,8 @@ |
995 | 1007 | } |
996 | 1008 | $wgOut->addHTML( '</fieldset>' ); |
997 | 1009 | |
| 1010 | + wfRunHooks( "RenderPreferencesForm", array( $this, $wgOut ) ); |
| 1011 | + |
998 | 1012 | $token = htmlspecialchars( $wgUser->editToken() ); |
999 | 1013 | $skin = $wgUser->getSkin(); |
1000 | 1014 | $wgOut->addHTML( " |