Jump to content

Manual:Hooks/TitleReadWhitelist

From mediawiki.org
TitleReadWhitelist
Available from version 1.19.0
Called at the end of read permissions checks, just before adding the default error message if nothing allows the user to read the page.
Define function:
public static function onTitleReadWhitelist( $title, $user, &$whitelisted ) { ... }
Attach hook: In extension.json:
{
	"Hooks": {
		"TitleReadWhitelist": "MediaWiki\\Extension\\MyExtension\\Hooks::onTitleReadWhitelist"
	}
}
Called from: File(s): Permissions/PermissionManager.php
Interface: TitleReadWhitelistHook.php

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


If a handler wants a title to not be whitelisted, it should set $whitelisted to false and return false to prevent other calls to this hook from interfering.

Details

[edit]
  • $title: Title object being checked against
  • $user: Current user object
  • &$whitelisted: Boolean value of whether this title is whitelisted