Extension:NoViewOnBlock

Category:Extensions which host their code in-wiki Category:Unmaintained extensions#NoViewOnBlock Category:Extensions without an imageCategory:Extensions without a compatibility policyCategory:Extensions with unknown license
MediaWiki extensions manual
NoViewOnBlock
Release status: unmaintainedCategory:Unmaintained extensions
Implementation User rights Category:User rights extensions
Description Blocked users can't view the wiki
Author(s) Jacob Myers (spaztalk)
Latest version 0.1
MediaWiki Tested on 1.10.Category:Extensions with manual MediaWiki version
License CC0 waiver (public domain)
Download this page
Category:All extensionsCategory:Extensions not in ExtensionJson

Description

This extension prevents blocked users from viewing the wiki

Installation

Copy this into extensions/NoBlockedUserView.php:

extensions/NoBlockedUserView.php

<?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

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

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. 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.

See also

Category:View page extensions
Category:All extensions Category:Extensions not in ExtensionJson Category:Extensions which host their code in-wiki Category:Extensions with manual MediaWiki version Category:Extensions with unknown license Category:Extensions without a compatibility policy Category:Extensions without an image Category:Unmaintained extensions Category:UserCan extensions Category:User rights extensions Category:View page extensions