Manual:Hooks/SpecialRandomGetRandomTitle

From MediaWiki.org
Jump to: navigation, search
SpecialRandomGetRandomTitle
Available from version 1.16.0
Modify the selection criteria for Special:Random

*Define function:
function fnMyHook( &$randstr, &$isRedir, &$namespaces, &$extra, &$title ) { ... }

*Attach hook:
$wgHooks['SpecialRandomGetRandomTitle'][] = 'MyExtensionHooks::someExample';
Called from: SpecialRandompage.php

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


[edit] Details

Allows extensions to modify the selection criteria used in Special:Random and subclasses of it.

  • &$randstr: A random number string, generatated by wfRandom
  • &$isRedir: Boolean, whether or not the page to be selected should be a redirect
  • &$namespaces: An array of namespace indexes to get the page from
  • &$extra: An array of extra SQL statements added to the WHERE clause of the query
  • &$title: A Title object to redirect to if the hook returns false (must be set if the hook returns false)
Personal tools
Namespaces
Variants
Actions
Site
Support
Download
Development
Communication
Print/export
Toolbox