You are here Home > Know-how > MediaWiki - CMS > Authentication / Authorization > Block anonymous Users
MediaWiki - CMS
 

7.1 Block anonymous Users

15.06.2007
7 Authentication / Authorization [  up  ] - [ A - Z ] - [ top ] 7.2 includes/AuthPlugin.php

7.1   Block anonymous Users
7.2   includes/AuthPlugin.php
7.3   Authorization
7.3.1   Restrict Access

Important

Prevent publishing from anonymous users

Edit file /var/www/html/wiki/includes/EditPage.php:

MediaWiki Release: 1.5.3

Status "User Not Logged In"

In function editForm(...


if ( 'save' == $formtype ) {
        # -- No anonymous users
        if ( $wgUser->isAnon() ) {
                $this->userNotLoggedInPage();
                return;
        }

How to prevent publishing from users not e-mail confirmed

Status "User is not Email Confirmed"

In function editForm(...

if ( 'save' == $formtype ) {
        # -- Not e-mail confirmed
        if ( !$wgUser->isEmailConfirmed() ) {
                $this->userNotConfirmedPage();
                return;
        }

You will have to add this function in EditPage.php as well:

...

        function userNotConfirmedPage() {
                global $wgOut;

                $wgOut->setPageTitle( wfMsg( 'blockedtitle' ) );
                $wgOut->setRobotpolicy( 'noindex,nofollow' );
                $wgOut->setArticleRelated( false );

                $wgOut->addWikiText( wfMsg( 'blockedtitle' ) );
                $wgOut->returnToMain( false );
        }
...

Special Note on WikiSysop

You had to make this sql update if you need WikiSysop can update pages after this patch:

mysql> UPDATE foo_user SET user_email_authenticated=20051128163934, user_email='reto@example.com' WHERE user_name='WikiSysop';


See also:


7 Authentication / Authorization       A - Z Index       Top       Disclaimer       7.2 includes/AuthPlugin.php


$Id: block-anonymous-users.html,v 1.128 2007/06/15 11:49:14 webcms Exp $
copyright © 2005-2007 by reto