[Mediawiki-l] Customise Special:Preferences page (SpecialPageExecuteBeforePage hook)

Matthew Vickery vickery.matthew at gmail.com
Thu Jun 21 13:44:20 UTC 2007


Hi All,

I am trying to customise the Special:Preferences page to remove tabs and
change certain form fields.  My amendments are relatively simple to achieve
but editing includes/SpecialPreferences.php.  However I would rather use an
extension and keep the core code intact.  I have tried using the
SpecialPageExecuteBeforePage hook, but this seems not to work as expected
(see my extension code below).  The following note in the core code,
includes/SpecialPage.php, stating that the SpecialPageExecuteBeforePage hook
needs to be fixed:
# FIXME: these hooks are broken for extensions and anything else that
subclasses SpecialPage.

If this hook is not due to be fixed soon will someone please offer another
way to amend the Special:Preferences page without hacking the core code?

My extension code:

$wgHooks['SpecialPageExecuteBeforePage'][] = 'CustomUserPreferencesPage';

function CustomUserPreferencesPage($specialpage, $par, $func) {

  // Check if this hook has been called from the correct page
  if ($specialpage->mName == 'Preferences') {

    global $IP ;

    $specialpage->file($IP .
"/extensions/CustomUserPreferencesPage/templates/CustomSpecialPreferences.php")
;

  }

  return true ;
}

Many thanks in advance,

Matthew

MediaWiki version 1.10.0
PHP version 5.2.2


More information about the MediaWiki-l mailing list