Manual talk:Hooks/SpecialPage initList

From MediaWiki.org
Jump to navigation Jump to search

This hook appears to be broken in version 1.12 -- no functions that hook into it ever get invoked. See Bug 14494.--Hoggwild5 14:49, 10 June 2008 (UTC)

Example: Disabling Special:UserLogin and Special:UserLogin pages[edit]

In LocalSettings.php you can use the SpecialPage_initList hook to unset unwanted built-in special pages. See "making a few SpecialPages restricted" if you need conditional unsetting of special pages for example for certain user groups. The general message "You have requested an invalid special page." is shown if users try to access such unset special pages.

function disableSomeSpecialPages(&$list) {
  unset($list['Userlogout']);
  unset($list['Userlogin']);
  return true;
}
$wgHooks['SpecialPage_initList'][]='disableSomeSpecialPages';

Tested with MediaWiki 1.15.1 and PHP 5.2.12. --Wikinaut 17:32, 7 January 2010 (UTC)