[pmwiki-users] authuser / Setting the author automatically

Patrick R. Michaud pmichaud at pobox.com
Wed Feb 8 17:37:13 CST 2006


Because of the mailing list problems I apparently didn't get any
of the messages in the thread concerning this topic.  Here's my
answer...

I spent a good portion of lunch today thinking about setting
$Author based on $AuthId, and I think I've come to the conclusion
that it will be built-in by default in author.php.

Thus, author.php will use the following logic to set the value
of $Author (some cookie details omitted for clarity):

    if (!isset($Author)) {
      if (!isset($_POST['author'])) $Author = $_POST['author'];
      elseif ($_COOKIE['author']) $Author = $_COOKIE['author'];
      else $Author = $AuthId;
    }

This leaves us with the following:

- If a site isn't using authuser.php or otherwise setting $AuthId,
  then things work as they always have.

- If a site includes authuser.php or sets $AuthId, then $Author
  defaults to $AuthId but the author has the ability to set or change
  it.

- If a site administrator wishes to force $Author = $AuthId such that
  an author cannot override it, use:

       include_once("$FarmD/scripts/authuser.php");
       $Author = $AuthId;

- If a site administrator wants user-based authentication but doesn't
  want $Author to default to $AuthId, use:

       include_once("$FarmD/scripts/author.php");
       include_once("$FarmD/scripts/authuser.php");

I think that covers all of the cases.  Comments?

Pm




More information about the pmwiki-users mailing list