General procedure for extensions is to put the code in a .php in the
extensions/ directory. Then, in LocalSettings.php, add something like the
following near the bottom of the file.
require_once "$IP/extensions/MyExtension.php";
Greg
On 2/19/07, Giovanni Gherdovich <gherdovich(a)students.math.unifi.it> wrote:
Thankyou Gragory for the quick reply.
When I will have tried your code I will post a feedback.
Sorry, but I'm not an expert MW hacker: where I have to put your
code? in LocalSettings.php or where?
regards,
Giovanni Gherdovich
2007/2/19, Gregory Szorc <gregory.szorc(a)gmail.com>om>:
The following allows anonymous users to edit talk
pages. You can use
this
as a basis for whatever you need done.
$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;
}
Instead of $title->isTalkPage(), you could have something like:
$anonymousAllowedEdit = array('Main Page', 'Page 1', 'Page 2');
if (in_array($title->getFullText(), $anonymousAllowedEdit) &&
$title->isSemiProtected('edit') === false) {
$result = true;
...
}