Extension:NoViewOnBlock
Appearance
This extension stores its source code on a editable wiki page rather than in a code repository. As a result, this code may be maliciously altered. It may contain security vulnerabilities, and will not receive localisation updates from translatewiki.net . Developers are strongly encouraged to host their code in a code repository rather than a wiki page so that the extension can be properly maintained, reviewed, and kept secure. |
This extension is currently not actively maintained! Although it may still work, any bug reports or feature requests will more than likely be ignored. |
Release status: unmaintained |
|
---|---|
Implementation | User rights |
Description | Blocked users can't view the wiki |
Author(s) | Jacob Myers (spaztalk) |
Latest version | 0.1 |
MediaWiki | Tested on 1.10. |
License | CC0 waiver (public domain) |
Download | this page |
Description
[edit]This extension prevents blocked users from viewing the wiki
Installation
[edit]Copy this into extensions/NoBlockedUserView.php:
extensions/NoBlockedUserView.php
[edit]<?php
$wgHooks['userCan'][] = 'CheckUserBlocked';
function CheckUserBlocked( $title, $user, $action, &$result ) {
global $wgUser;
if( $wgUser->isBlocked() && $action == 'read' ) {
$result = false;
return false;
} else {
$result = null;
return true;
}
}
Now add this to your LocalSettings.php file:
LocalSettings.php
[edit]require_once("$IP/extensions/NoBlockedUserView.php");
Status
[edit]This module works very well, however there are some limitations and a minor bug:
- Blocked users will be turned away with "The action you have requested is limited to users in one of the groups *, user." This may not be the message you want to send. Patches welcome to fix it. In the meantime, you can simply edit MediaWiki:Badaccess-groups, and change the contents to something even more generic (I.E., You can't perform that action).
- All blocked users will be turned away, keep this in mind.