[pmwiki-users] Integrating AuthUser into existing site

Patrick R. Michaud pmichaud at pobox.com
Wed Oct 19 08:18:42 CDT 2005


On Wed, Oct 19, 2005 at 06:06:58AM -0700, Wesley Tanaka wrote:
> >     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
> >     }
> 
> Thanks!  I'll try it out!  Is it possible to do this from inside a skin?  I'm
> calling the rest of my site initialization code from inside my skin 
> right now.  AuthId seems to be unset somewhere between setting it in a 
> skin and inside of the PmWikiAuth function where it seems to be used.

Any global variables that are set from within a skin have to be
explicitly declared global; i.e., you'd have to do

    global $AuthId;

in the skin code if you want the skin to be able to set the
authentication value.  Without this, you're just setting a local 
$AuthId in PmWiki's SetSkin() function and not the global $AuthId 
that PmWikiAuth uses.

Unfortunately, I haven't found a good way to be able to automatically
treat variables set in the skin config files as global.  

Also, I personally would keep identification/authentication/authorization
tasks completely separate from skin configuration, but that's just me.

Pm




More information about the pmwiki-users mailing list