My users keep accidentally editing anonymously when they think they're
logged in; this has gotten so bad that a few of them have asked me to
disable anonymous edits. Instead, I wrote the patch below my sig, set
$wgEnableAnonWarning to true, and put the following in
MediaWiki:AnonWarning:
<div class="usermessage">You are currently editing anonymously. Would
you like to <a href="$1">log in</a> before editing?</div>
It was quite effective. ;^)
Below patch is against MediaWiki 1.3.11 (the latest version marked
stable in Gentoo Linux's Portage). I'm not much of a PHP guy, so it's
likely suboptimal, but it might be useful.
--
Brent 'Dax' Royal-Gordon <brent(a)brentdax.com>
Perl and Parrot hacker
"I used to have a life, but I liked mail-reading so much better."
--- EditPage.php.orig 2005-04-25 21:44:51.000000000 -0700
+++ EditPage.php 2005-04-25 23:21:08.000000000 -0700
@@ -133,6 +133,7 @@
global $wgLang, $wgParser, $wgTitle;
global $wgAllowAnonymousMinor;
global $wgWhitelistEdit;
+ global $wgEnableAnonWarning;
global $wgSpamRegex, $wgFilterCallback;
$fname = 'EditPage::editForm';
@@ -379,6 +380,11 @@
" accesskey='".wfMsg('accesskey-minoredit')."' id='wpMinoredit' />".
"<label for='wpMinoredit'
title='".wfMsg('tooltip-minoredit')."'>{$minor}</label>";
}
+
+ if( !$wgUser->getID() && $wgEnableAnonWarning) {
+ $sk=$wgUser->getSkin();
+ $wgOut->addHTML(wfMsg("anonWarning",
$sk->makeSpecialUrl('Userlogin', 'returnto=' .
$wgTitle->getPrefixedUrl() )));
+ }
$watchhtml = "";