Manual:Hooks/GetUserBlock

GetUserBlock
Available from version 1.34.0 (Gerrit change 525305)
Modify the block found by the block manager.
Define function:
public static function onGetUserBlock( User $user, $ip, MediaWiki\Block\AbstractBlock &$block ) { ... }
Attach hook:

In extension.json:

{
	"Hooks": {
		"GetUserBlock": "MyExtensionHooks::onGetUserBlock"
	}
}
Called from:File(s): block/BlockManager.php
Function(s): getUserBlock
Interface:GetUserBlockHook.php

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

The block may be a single block or a composite block made from multiple blocks; the original blocks can be seen using MediaWiki\Block\CompositeBlock::getOriginalBlocks()

DetailsEdit

  • $user: User object
  • $ip: IP address of user
  • &$block: MediaWiki\Block\AbstractBlock object