Extension:NoBlockedUserView

From MediaWiki.org

Jump to: navigation, search
Manual on MediaWiki Extensions
List of MediaWiki Extensions
NoViewOnBlock

Release status: experimental

Implementation User rights
Description Blocked users can't view the wiki
Author(s) Jacob Myers (spazTalk)
Last Version 0.1
MediaWiki Tested on 1.10.
License No license specified
Download this page

Contents

[edit] Description

This extension prevents blocked users from viewing the wiki

[edit] Installation

Copy this into extensions/NoBlockedUserView.php:

[edit] extensions/NoBlockedUserView.php

<?php
global $wgHooks;
$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:

[edit] LocalSettings.php

require_once("$IP/extensions/NoBlockedUserView.php");

[edit] Status

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, I plan to make this configurable later on. 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.
Personal tools