How-to: confine editing to talk pages

From Gwiki

Jump to: navigation, search

In the "extensions" folder, add an AllowTalkEdits.php file that contains:

<?php
$wgHooks['userCan'][] = 'wfAllowTalkEdits';

function wfAllowTalkEdits(&$title, &$user, $action, &$result)
{
    if($action != 'edit' && $action != 'create')
    {
        $result = true;
    }
    elseif(!$title->isTalkPage())
    {
        $result = $user->isAllowed('editmain');
    }
    else
    {
        $result = $user->isAllowed('edittalk');
    }

    return $result;
}
?>

Then edit the LocalSettings.php file, and add something like:

$wgGroupPermissions['*']['edittalk'] = TRUE;
$wgGroupPermissions['sysop']['editmain'] = TRUE;
require_once("extensions/AllowTalkEdits.php");

Give edittalk to whomever you want to be able to edit talk pages, and give editmain to whomever you want to be able to edit main pages.

Personal tools