Last modified: 2012-03-19 20:41:48 UTC
Created attachment 7237 [details] Screenshot The following simple extension will cancel the block, and the message "Block aborted" will be displayed at the top of the block form. However a large red <hookaborted> message will also be displayed, below blockiptext. The latter shouldn't be shown if the extension already returns an error message of its own, and should be something more user-friendly otherwise. <?php if ( !defined( 'MEDIAWIKI' ) ) { exit; } $wgHooks['BlockIp'][] = 'BlockIpTest'; function BlockIpTest( &$ban, &$user ) { return 'Block aborted'; }
Can you confirm whether this still occurs in trunk? The blocking system has been completely rewritten since 1.15.
It's slightly better in that it displays the message "The modification you tried to make was aborted by an extension hook." instead of <hookabort>, but it still doesn't allow the extension to customize that message, instead the extension's error message is outputted at the top and the title of the page changes to "internal error".
Created attachment 9228 [details] Quick and dirty hack Here's a patch to show you a rough idea of what I'd like. Instead of returning a string, the extension can set the third parameter of the blockip hook and return false. The problem with this patch though is that it requires error to be a message key.
And the extension to test this: <?php if ( !defined( 'MEDIAWIKI' ) ) { exit; } $wgHooks['BlockIp'][] = 'BlockIpTest'; $wgExtensionMessagesFiles['PageList'] = dirname( __FILE__ ) . '/blocktest.i18n.php'; function BlockIpTest( &$ban, &$user, &$error ) { $error = 'test-abort'; return false; } and blocktest.i18n.php is: <?php $messages = array(); $messages['en'] = array( 'test-abort' => 'Testing block abort', );