Manual:Hooks/UserIsBlockedFrom

From MediaWiki.org
Jump to: navigation, search
UserIsBlockedFrom
Available from version 1.16.0
Check if a user is blocked from a specific page (for specific block exemptions).
Define function:
public static function onUserIsBlockedFrom( $user, $title, &$blocked, &$allowUsertalk ) { ... }
Attach hook:

In extension.json:

{
	"Hooks": {
		"UserIsBlockedFrom": [
			"MyExtensionHooks::onUserIsBlockedFrom"
		]
	}
}

For MediaWiki ≤1.25:

$wgHooks['UserIsBlockedFrom'][] = 'MyExtensionHooks::onUserIsBlockedFrom';
Called from: File(s): User.php

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

Details[edit]

  • $user: User in question
  • $title: Title of the page in question
  • &$blocked: Out-param, whether or not the user is blocked from that page.
  • &$allowUsertalk: If the user is blocked, whether or not the block allows users to edit their own user talk pages.