Extension:TalkRight

The Talkright 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
On a semi private wiki, a user can be allowed to read but not to edit the content of a page as well as its talk page. This is done by setting:

Now, if you want to encourage comments to your wiki from a group of persons, by giving them rights to edit the talk pages only, you need to install this Talkright extension and to add, for example, the following two lines:

Installation

 * 1) Make a folder 'TalkRight' in MediaWiki's extensions folder.
 * 2) Copy the code below in a file named 'TalkRight.php' in this 'TalkRight' folder.
 * 3) Add the following line in the LocalSettings.php file:
 * 4) Now you can use the 'talk' right within the group user rights.
 * 1) Now you can use the 'talk' right within the group user rights.

for MediaWiki 1.19 and 1.20
Tested with: permission independent from article edition', 'url' => 'https://www.mediawiki.org/wiki/Extension:Talkright', ); $wgHooks['AlternateEdit'][] = 'TalkRight::alternateEdit'; $wgHooks['ParserBeforeStrip'][] = 'TalkRight::giveEditRightsWhenViewingTalkPages';
 * MW 1.20.2 - skins: Vector, monobook
 * 1) Register hooks

$wgAvailableRights[] = 'talk'; class TalkRight {
 * 1) Global 'talk' right

/**    * Bypass edit restriction when EDITING pages if user has 'talk' right and page is a talk (discussion) page. * @param $&editPage the page edition object * @return true to resume edition to normal operation */   static function alternateEdit( $editPage ) { global $wgOut, $wgUser, $wgRequest, $wgTitle; if ( $wgTitle->isTalkPage && $wgUser->isAllowed( 'talk' ) ) { array_push( $wgUser->mRights, 'edit' ); }       return true; }

/**    * Bypass edit restriction when VIEWING pages if user has 'talk' right and page is a talk (discussion) page. * This is probably not the ideal hook to use. I just needed one earlier than creation of section links, edit tab and add topic tab * @param &$parser parser object, used to gain access to User and Title objects * @param &$text unused * @param &$strip_state unused * @return true and false both seemed to work. Manual:Hooks/ParserBeforeStrip doesn't indicate what return value affects */       static function giveEditRightsWhenViewingTalkPages ( &$parser, &$test, &$test ) { $user = $parser->getUser; if ( $parser->getTitle->isTalkPage && $user->isAllowed( 'talk' ) ) { array_push( $user->mRights, 'edit' ); }       return true; } }

for MediaWiki 1.16 – 1.18
New in this version: No need to modify 'includes/SkinTemplate.php' to edit "view source" button.

Tested with:
 * MW 1.16 - skins: monobook
 * MW 1.18

for MediaWiki 1.12 and 1.13
This code has been tested on MediaWiki 1.12 and 1.13.

for MediaWiki 1.6.X
This code has been tested on MediaWiki 1.6.1 and 1.6.7. DOES NOT WORK FOR MediaWiki 1.12 and 1.13.