[pmwiki-users] HTTP Authentication and use of login name

christian.ridderstrom at gmail.com christian.ridderstrom at gmail.com
Sat Jun 10 03:44:06 CDT 2006


On Fri, 9 Jun 2006, Patrick R. Michaud wrote:

> On Sat, Jun 10, 2006 at 02:31:59AM +0200, christian.ridderstrom at gmail.com wrote:
>>
>> How could I get the name from Apache BA as the default user name, only
>> when no user name is known? (Alternatively, set it as the default the
>> first time)
>
> if (@$_SERVER['REMOTE_USER'] && !@$_COOKIE['author'])
>  $_POST['author'] = $_SERVER['REMOTE_USER'];

Thanks, seems to work nicely.  Here's what I use in my config.php now:

if(true) {
   // Require the author's name to be set
   $EnablePostAuthorRequired = 1;

   // Change the error message to be more visible
   $AuthorRequiredFmt = "<h3 class='wikimessage' "
     . " style='color:red; text-align:center;'>"
     . "$[An author name is required.]</h3>";

   // Set $author if the session cookie has no author name stored
   if (@$_SERVER['REMOTE_USER'] && !@$_COOKIE['author'])
     $_POST['author'] = $_SERVER['REMOTE_USER'];
}

Since I'm using Apache BA, I guess it doesn't make that much sense to 
require an author name any more.

Anyway, I think this should be documented somewhere. Any ideas on where?

/Christian

-- 
Christian Ridderström, +46-8-768 39 44               http://www.md.kth.se/~chr


More information about the pmwiki-users mailing list