On 7/11/06, Green, Chris chris.green@landg.com wrote:
Excuse me for asking what may be basic questions to some people but I am new to MediaWiki.
I have a new group set up with certain users granted that privilege e.g. false for edit and true for talk.
How can I, if poss, apply that group privilege to specific pages only.
The UserCan hook can do what you want. Here is an example:
<?php
$wgExtensionFunctions[] = 'MediaWiki_AnonymousEditsExtension';
function MediaWiki_AnonymousEditsExtension() { global $wgHooks;
$wgHooks['userCan'][] = 'MediaWiki_AnonymousEditsUserCan'; }
function MediaWiki_AnonymousEditsUserCan(&$title, &$user, $action, &$result ) { if ($action == 'edit') { if ($title->isTalkPage()) { $result = true;
if (!in_array('edit', $user->getRights())) { $user->mRights[] = 'edit'; } } }
return true; }
Create a file like this, changing the logic to do what you want (look at includes/Title.php, includes/User.php for methods available with the $title and $user variables, respectively). Then, add a 'require' line to LocalSettings.php which includes this newly-created file.
Greg