The aim of this patch is to encourage users using their preferences. There are a few users of the Wiki we are running, and I just want them to remember using their names, rather than to have them configure their passwords etc. The effect of the patch is as follows: if you set the variable $NoAnonyms = 1 in your config file, then an additional check is made: users who are not Admins / Editors and do not have a defined user name are not allowed to edit the pages. Here is the diff -c:
(the lines marked with "!" were modified; lines marked with "+" were added; lines marked with "-" were removed; everything else does not matter)
Note: I think that this was done before in /RequireAUserName and in UseModD's LoginRework. However, I like my solution better :-) because you can switch between the standard and the new behaviour with a single config variable.
*** wiki.pl 2006-01-16 15:03:51.000000000 +0100
--- index.pl 2006-01-16 15:13:56.000000000 +0100
***************
*** 63,69 ****
$OpenPageName @KeptList @IndexList $IndexInit $TableMode
$q $Now $UserID $TimeZoneOffset $ScriptName $BrowseCode $OtherCode
$AnchoredLinkPattern @HeadingNumbers $TableOfContents $QuotedFullUrl
! $ConfigError $UploadPattern );
# == Configuration =====================================================
$UseConfig = 1; # 1 = use config file, 0 = do not look for config
--- 63,69 ----
$OpenPageName @KeptList @IndexList $IndexInit $TableMode
$q $Now $UserID $TimeZoneOffset $ScriptName $BrowseCode $OtherCode
$AnchoredLinkPattern @HeadingNumbers $TableOfContents $QuotedFullUrl
! $ConfigError $UploadPattern $NoAnonyms);
# == Configuration =====================================================
$UseConfig = 1; # 1 = use config file, 0 = do not look for config
***************
*** 177,182 ****
--- 177,183 ----
$UseMetaWiki = 0; # 1 = add MetaWiki search links, 0 = no MW links
$BracketImg = 1; # 1 = [url url.gif] becomes image link, 0 = no img
$BodyOnly = 0; # 1 = output body for template 0 = full HTML output
+ $NoAnonyms = 0 ; # 1 = editing allowed only for users with a defined username
# Names of sites. (The first entry is used for the number link.)
@IsbnNames = ('bn.com', 'amazon.com', 'search');
***************
*** 2698,2703 ****
--- 2699,2710 ----
return 1 if (&UserIsEditor());
return 0;
}
+
+ if($NoAnonyms) {
+ return 1 if (&UserIsEditor());
+ return 0 unless(&GetParam("username") ne "") ;
+ }
+
if ($deepCheck) { # Deeper but slower checks (not every page)
return 1 if (&UserIsEditor());
return 0 if (&UserIsBanned());
***************
*** 3214,3219 ****
--- 3221,3230 ----
print T('Editing not allowed: user, ip, or network is blocked.');
print "<p>";
print T('Contact the wiki administrator for more information.');
+ } elsif($NoAnonyms && !(&GetParam("username") ne "")) {
+ print T('Editing not allowed: anonyms not allowed.') ;
+ print "<p>" ;
+ print T('Please click on ' . &ScriptLink("action=editprefs", T('Preferences')) . ' and set your username') ;
} else {
print Ts('Editing not allowed: %s is read-only.', $SiteName);
}