[pmwiki-users] Integrating AuthUser into existing site

Patrick R. Michaud pmichaud at pobox.com
Wed Oct 19 07:56:42 CDT 2005


On Wed, Oct 19, 2005 at 05:48:44AM -0700, Wesley Tanaka wrote:
> > Yes.  The Authenticate() function in authuser.php just sets a
> > $_SESSION variable as well as setting $AuthId; since you already
> > have the authentication information in $_SESSION, you only need to
> > set $AuthId.
> 
> After looking at the source code, I'm not sure how to do what I want.  
> I'd like to somehow distinguish between logged in users and non-logged 
> in users in RecentChanges, AllRecentChanges, and in action=diff.  
> If a user made a change while they were logged in, I'd like their 
> username to show up.  If they weren't logged in, I'd like their 
> IP address to show.

Ahhh, for that there's a different variable, $Author.  $AuthId is
the name under which an author is authenticated (used for access
control), while $Author is the name that appears in RecentChanges
and the page history.  There's nothing that prevents these from
having the same value, but PmWiki doesn't force them to be the same.

So, perhaps what you want is:

    if (logged_in_user) {
      $AuthId = $username;                     # for authentication
      $Author = $username;                     # for RecentChanges, history
    } else {
      $Author = $_SERVER['REMOTE_ADDR'];       # for RecentChanges, history
      $AuthorLink = $Author;                   # for RecentChanges, history
    }

Pm




More information about the pmwiki-users mailing list