Jump to content

User:Phillev

From mediawiki.org

Extensions

[edit]

adds a talk permission independant from article edition

What can this extension do?

[edit]

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

[edit]

The following example creates a group whose users can comment on articles but not edit their contents:

$wgGroupPermissions['commentators']['edit'] = false;
$wgGroupPermissions['commentators']['talk'] = true;

Installation

[edit]

1. Copy the code below in a file named talkright.php in MediaWiki's extensions folder.

2. Add the following line in the LocalSettings.php file:

require_once("$IP/extensions/talkright.php");

3. Edit tab in talk page : a "view source" button is still existing on talk pages. To fix this problem, modify includes/SkinTemplate.php on line 672 changing :

 
" if ( $this->mTitle->quickUserCan( 'edit' ) && ( $this->mTitle->exists() || $this->mTitle->quickUserCan( 'create' ) ) ) {"
to
" if ( ($this->mTitle->quickUserCan( 'edit' ) || ($this->mTitle->isTalkPage() && $wgUser->isAllowed('talk'))) && ( $this->mTitle->exists() || $this->mTitle->quickUserCan( 'create' ) ) ) {"

4. Now you can use the talk right within the group user rights.

History

[edit]
  • 05 August 2008 -- Version 1.2 -- Added credits for MediaWiki version 1.12, 1.13.

MediaWiki 1.12+ Code

[edit]

This code has been tested on MediaWiki 1.12 and 1.13.

<?php
/**
 * Talkright MediaWiki extension
 * @version 1.2
 * @author Marc Noirot - marc dot noirot at gmail
 * @author P.Levêque - User:Phillev
 * @link http://www.mediawiki.org/wiki/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.
 *
 * Edit tab in talk page
       a "view source" button is still  existing on talk pages. To fix this problem, modify includes/SkinTemplate.php on line 672 changing :
     " if ( $this->mTitle->quickUserCan( 'edit' ) && ( $this->mTitle->exists() || $this->mTitle->quickUserCan( 'create' ) ) ) {"
      to
     " if ( ($this->mTitle->quickUserCan( 'edit' ) || ($this->mTitle->isTalkPage() && $wgUser->isAllowed('talk'))) && ( $this->mTitle->exists() || $this->mTitle->quickUserCan( 'create' ) ) ) {"

*/

if (!defined('MEDIAWIKI')) die();

$wgExtensionCredits['other'][] = array(
	'name' => 'Talkright',
	'version' => '1.2',
	'author' => array('P.Levêque', 'Marc Noirot'),
	'description' => 'Adds a <tt>talk</tt> permission independent from article edition',
	'url' => 'http://www.mediawiki.org/wiki/Extension:Talkright',
);


/* Register hooks */
$wgHooks['userCan'][] = 'userCanTalk';
$wgHooks['AlternateEdit'][] = 'alternateEdit';

/* Global 'talk' right */
$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, &$user, $action, &$result) {
	if ( $action = 'edit' && $title->isTalkPage() ) {
		$return = $user->isAllowed( 'talk' );
	}
	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;
}

Help

[edit]

Installation of MediaWiki on shared host where you don't have php.ini access. Resolved.

Update 30.10.2009 : To resolve this problem on a Apache server, you've to edit /Applications/MAMP/conf/php5/php.ini files and search the lines : "mbstring.func_overload" ; the first line has the value "7" and the second "0", then change their value " to "off"; then save, restart the server and it works perfectly.


  • MediaWiki version: 1.13.0
  • PHP version: 5.2.6
  • MySQL version: 5.0.51a-community

Question

[edit]

I would like to install Mediawiki on my shared HostServer. I cannot install mediawiki and have this fatal error :

MediaWiki 1.13.0 Installation
Don't forget security updates! Keep an eye on the low-traffic release announcements mailing list. 
Checking environment...
Please include all of the lines below when reporting installation problems.
PHP 5.2.6 installed 
Found database drivers for: MySQL 
Fatal: mbstring.func_overload is active! This option causes errors and may corrupt data unpredictably;
you cannot install or use MediaWiki unless this option is disabled. 
Cannot install MediaWiki.

Answer

[edit]

Follows these steps if you can not access to httpd.conf and php.ini from you Shared HostServer:

  • Create php.ini file in you public_html/ Home folder or www/
  • Add in your .htaccess : suPHP_ConfigPath /home/VOTREUSER/public_html/php.ini
  • Add in your php.ini : Magic_quotes_gpc = off

This should work