Extension:TalkRight

This extension makes the editing of talk pages a distinct action from the editing of articles to create finer permissions, by adding the talk right.

Usage
Copy the code below in a file named talkright.php in Mediawiki's extensions folder.

Add the following line in the LocalSettings.php file: include_once("extensions/talkright.php"); Now you can use the talk right within the group user rights.

Example
The following example creates a group whose users can comment articles but not edit their contents: $wgGroupPermissions['commentators']['edit'] = false; $wgGroupPermissions['commentators']['talk'] = true;

Code
This code has been tested on MediaWiki 1.6.1 and 1.6.7.

History:
 * 20 June 2006 -- Version 1.0.1 -- Added credits and extension version information.
 * 7 June 2006 -- Version 1.0 -- First release.

 'talkright',    'description' => 'adds a talk permission independant from article edition',    'url' => 'http://meta.wikimedia.org/wiki/Talkright_extension',    'author' => 'Marc Noirot',    'version' => '1.0.1' );

/*   global 'talk' right array_push($wgAvailableRights, 'talk');

/** * Can user edit the given page if it's a talk page ? * @param &$title the concerned page * @param &$wgUser the current mediawiki user * @param $action the action performed * @param &$result (out) true or false, or null if we don't care about the parameters */ function userCanTalk(&$title, &$wgUser, $action, &$result) { if ($action == 'edit' && $title->isTalkPage) { if (!$wgUser->isAllowed('talk')) { $result = false; return false; }   }    return true; }

/** * Bypass edit restriction when editing pages if user can talk and page is a comment. * @param $&editPage the page edition object * @return true to resume edition to normal operation */ function alternateEdit(&$editPage) { global $wgOut, $wgUser, $wgRequest, $wgTitle;

if ($wgTitle->isTalkPage && $wgUser->isAllowed('talk')) { array_push($wgUser->mRights, 'edit'); }   return true; }

/*   register global hooks $wgHooks['userCan'][] = 'userCanTalk'; $wgHooks['AlternateEdit'][] = 'alternateEdit'; ?>