From charlesreid1

Installation

(Some stuff will eventually go here)

Permissions

Changing Namespace Permissions

This is a handy way for you to create custom permissions for parts of your wiki.

Step 1: Select Protected Namespace

This step consists of either selecting an existing namespace to protect, or creating a new namespace.

I will use the example of the "Secret" namespace. As an example, on a public wiki the page [[Message]] would be open to the public, and viewable by anyone. But if this were added to the Secret nanemspace, i.e. if it were at [[Secret:Message]], then it would only be viewable by those with permission to view the Secret namespace.

Add the new namespace to LocalSettings.php with the following code:

$wgExtraNamespaces = array( 100 => "Secret");

If you want to create more namespaces, you can number them 101, 102, 103, etc., or really, whatever you feel like. (Just keep the numbers big so they don't interfere with existing namespaces.)

Step 2: Modify includes/Title.php

The file includes/Title.php is a header file that is included on all MediaWiki pages. When pages are loaded, the load request is processed through Title.php.

Look for the piece of code that looks like this:

        if( $wgUser->isAllowed( 'read' ) ) {
            return true;
        } else {
            global $wgWhitelistRead;

This piece of code checks if a user has global "read" permissions, and if so, it proceeds to load the page.

We will create a new permission called "read_secret" that, if a user has, will allow them to see any page in the Secret namespace.

Add a check for the new "read_secret" permission:

        if( $this->getNamespace() == 100 ) { 
            //this is "Secret" namespace
            return $wgUser->isAllowed('read_secret');
        }   
        if( $wgUser->isAllowed('read') ) {
            return true;
        } else {
            global $wgWhitelistRead;

Step 3: Create a group with the new permission

The next step is to create a MediaWiki group that will have the just-created permission, "read_secret". I'll name this group something really creative like "secret":

$wgGroupPermissions['secret']['read_secret'] = true;

Step 4: Add users to new group

The last step is to add users to the new group. You can go to the page Special:UserRights on your wiki, and it will prompt you for a user. Once you enter a user's name, you will see a list of groups that are available to add a user to:

MWGroups.png

(Of course, this will depend on your wiki's configuration. Also, you have to be an administrator or a bureaucrat to add users to new groups.)

You can check the "secret" box, and the user will now be a member of the group "secret" and have the permission "read_secret", making him or her able to access pages in the Secret namespace!

Extensions

ArticleComments

I installed the Article Comments extension from here: http://www.mediawiki.org/wiki/Extension:ArticleComments

Once you install it, you can add a comments form for feedback by adding the following to the wiki page:

<comments />

Errors

I had some troubles that weren't addressed by this extension's page, they looked like this:

Warning: Missing argument 2 for wfArticleCommentsAfterContent()in /path/to/ArticleComments.php on line 207

This was fixed following [1]:

 - function wfArticleCommentsAfterContent( $data, $skin ) {
 + function wfArticleCommentsAfterContent( &$data ) {
 -      global $wgRequest, $wgArticleCommentsNSDisplayList;
 +      global $wgRequest, $wgArticleCommentsNSDisplayList, $wgUser;

        # Short-circuit for anything other than action=view or action=purge
        if ( $wgRequest->getVal( 'action' ) &&
                $wgRequest->getVal( 'action' ) != 'view' &&
                $wgRequest->getVal( 'action' ) != 'purge'
        )
        {
                return true;
        }

        # Short-circuit if displaylist is undefined, empty or null
        if ( $wgArticleCommentsNSDisplayList == null ) {
                return true;
        }

 +      $skin = $wgUser->getSkin();
        $title = $skin->getTitle();
        if ( !$title->exists() ) {
                return true;
        }