[pmwiki-users] authuser forcing Author name stopped working?

H. Fox haganfox at gmail.com
Thu Jul 7 19:17:53 CDT 2005


On 7/7/05, Neil Herber <nospam at eton.ca> wrote:
> As a further puzzlement, it looks like $AuthId is not getting set by
> authuser.php, which would explain why $Author doesn't get set. Is anyone
> having the same problem? Can anyone suggest what the problem is?
> 
> At 2005-07-07  04:55 PM -0400, Neil Herber is rumored to have said:
> >I thought I had this working, but it appears not ...
> >
> >I am using authuser.php on a semi-private wiki to force users to enter a
> >user name and password.  I thought it used to force {$Author} to the
> >username through this code that appears in config.php:
> >
> >include_once("$FarmD/scripts/authuser.php");
> >     if ($AuthId) {
> >         $Author = $AuthId;
> >         setcookie('author',$Author,0,'/');
> >         }
> >
> >However, it doesn't seem to work now. Finger trouble on my end? This is
> >PmWiki 2b40 running on Windoze Apache 2.

$AuthId only gets set when you authenticate.  By that I mean only when
you see the password page.

Try this, which I haven't tested but it should work more reliably than
the code above.

  if ($action == 'edit' && ! @$_COOKIE['author']) {
    @session_start();
    $Author=$_SESSION['authid'];
    setcookie('author',$Author,0,'/');
  }

(I'm pretty sure the setcookie() line is not necessary.  Testing will
prove that out.)

If it works I'll add it to the RequireAuthor cookbook page, which I
extensively re-edited this morning.

Hagan




More information about the pmwiki-users mailing list