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:

Code
Tested with MW 1.20.2 - skins: Vector, monobook permission independent from article edition', 'url' => 'https://www.mediawiki.org/wiki/Extension:Talkright', ); $wgHooks['AlternateEdit'][] = 'TalkRight::alternateEdit'; $wgHooks['ParserBeforeStrip'][] = 'TalkRight::giveEditRightsWhenViewingTalkPages';
 * MediaWiki 1.19.x and 1.20.x
 * 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; } }