Hello,
this is the feedback to the tip kindly given by Gregory.
This is the code for the extension suggested from Gregory:
<?php
$wgExtensionFunctions[] = 'MediaWiki_AnonymousEditsExtension';
$wgHooks['userCan'][] = 'MediaWiki_AnonymousEditsUserCan';
function MediaWiki_AnonymousEditsUserCan(&$title, &$user, $action, &$result)
{
if ($action == 'edit') {
if ($title->isTalkPage() && $title->isSemiProtected('edit') ===
false) {
$result = true;
if (!in_array('edit', $user->getRights())) {
$user->mRights[] = 'edit';
}
}
}
return true;
}
?>
If I use this code, I got this error by the php interpreter of my webserver:
Warning: call_user_func(MediaWiki_AnonymousEditsExtension)
[function.call-user-func]: First argument is expected to be a
valid callback in /afs/math.unifi.it/service/beppolevi/includes/Setup.php
on line 314
So googled "MediaWiki_AnonymousEditsExtension", and I find a working
code to make the talkpages editable in a restricted wiki on this web page:
http://wiki.case.edu/CaseWiki:MediaWiki_modifications
Then I applied further tip of Gregory to that code, I got this working:
<?php
$wgExtensionFunctions[] = 'MediaWiki_AnonymousEditsExtension';
function MediaWiki_AnonymousEditsExtension() {
global $wgHooks;
$wgHooks['userCan'][] = 'MediaWiki_AnonymousEditsUserCan';
}
function MediaWiki_AnonymousEditsUserCan(&$title, &$user, $action, &$result)
{
$anonymousAllowedEdit = array('Page 1', 'Page 2');
if ($action == 'edit') {
if ($title->isTalkPage() ||
in_array($title->getFullText(), $anonymousAllowedEdit)) {
$result = true;
if (!in_array('edit', $user->getRights())) {
$user->mRights[] = 'edit';
}
}
}
return true;
}
?>
This make anonimously editable only talkpages, Page_1 and Page_2.
I would note that if you put the assignment
$anonymousAllowedEdit = array('Page 1', 'Page 2');
out of the function MediaWiki_AnonymousEditsUserCan, the array
is not visible inside the function and you got an error.
Regards,
Giovanni Gherdovich