From: Kunal Mehta Date: Sat, 18 Jan 2014 21:31:47 +0000 (-0800) Subject: Allow extensions to set a custom error message in the BlockIp hook X-Git-Tag: 1.31.0-rc.0~17209^2 X-Git-Url: http://git.cyclocoop.org/data/%24oldEdit?a=commitdiff_plain;h=ebdfe504d9f5e12ff59283332d817b0887ebec21;p=lhc%2Fweb%2Fwiklou.git Allow extensions to set a custom error message in the BlockIp hook Change-Id: I2e3773e22c78370e6ca1de49e7b0976b68d8d76b --- diff --git a/docs/hooks.txt b/docs/hooks.txt index b61743000a..51cf65cebd 100644 --- a/docs/hooks.txt +++ b/docs/hooks.txt @@ -772,6 +772,7 @@ $block: Block object (which is set to be autoblocking) 'BlockIp': Before an IP address or user is blocked. $block: the Block object about to be saved $user: the user _doing_ the block (not the one being blocked) +&$reason: if the hook is aborted, the error message to be returned in an array 'BlockIpComplete': After an IP address or user is blocked. $block: the Block object that was saved diff --git a/includes/specials/SpecialBlock.php b/includes/specials/SpecialBlock.php index 1aa800690a..61b59b9ba4 100644 --- a/includes/specials/SpecialBlock.php +++ b/includes/specials/SpecialBlock.php @@ -695,8 +695,9 @@ class SpecialBlock extends FormSpecialPage { $block->isAutoblocking( $data['AutoBlock'] ); $block->mHideName = $data['HideUser']; - if ( !wfRunHooks( 'BlockIp', array( &$block, &$performer ) ) ) { - return array( 'hookaborted' ); + $reason = array( 'hookaborted' ); + if ( !wfRunHooks( 'BlockIp', array( &$block, &$performer, &$reason ) ) ) { + return $reason; } # Try to insert block. Is there a conflicting block?