Manual:Hooks/SpecialPageExecuteBeforePage

From MediaWiki.org

Jump to: navigation, search
SpecialPageExecuteBeforePage
Available from version 1.6.0
Called before setting the page text of the special page

*Define function:
function fnMyHook($specialpage, $parameters, $function) { ... }

*Attach hook:
$wgHooks['SpecialPageExecuteBeforePage'][] = 'fnMyHook';
Called from: SpecialPage.php

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


[edit] Details

  • $specialpage: The SpecialPage being executed
  • $parameters: Any parameter passed to the page (i.e. /wiki/index.php/SpecialAllpages/Foo. Foo is the parameter)
  • $function: The function called to execute the special page (??)

[edit] Usage

There is a note in includes/SpecialPage.php where this hook is called stating that it is broken for extensions:

# FIXME: these hooks are broken for extensions and anything else that subclasses SpecialPage. 

This is due to the fact that extensions that subclass SpecialPage implement their own execute function. Since the hooks are fired in the SpecialPage parent class execute function they don't get called in the subclass. A bug has been filed for this, but the chances of it being fixed in the short term are probably small due to this subclass/parentclass problem.

Personal tools