[pmwiki-users] setting $Author with $AuthId as prefix
Patrick R. Michaud
pmichaud at pobox.com
Wed Jan 24 07:44:02 CST 2007
On Wed, Jan 24, 2007 at 12:48:34PM +1100, Kathryn Andersen wrote:
> On Tue, Jan 23, 2007 at 07:08:52AM -0600, Patrick R. Michaud wrote:
> > On Tue, Jan 23, 2007 at 10:49:43AM -0000, marc wrote:
> > > Isn't there a glitch with the hyphen after $AuthId? Won't Author be
> > > displayed, and recorded in RecentChanges, as
> > >
> > > Fred-
> >
> > Yes, you're correct (good catch!). How about the following instead?
> >
> > include_once("$FarmD/scripts/author.php");
> > include_once("$FarmD/scripts/authuser.php");
> > if (!$Author) $Author = $AuthId;
> > else $Author = "$AuthId-" . preg_replace('/^[^-]*-/', '', $Author);
> > $AuthorLink = "[[~$Author]]";
>
> Unfortunately, even that doesn't work properly, because since author.php
> will set $Author to $AuthId by default, you can get an Author becoming
> "$AuthId-$AuthId" which isn't what you want either.
Since author.php is loaded before authuser.php, there's
no way it can set $Author to $AuthId by default (because $AuthId
isn't set). So, it simply is using any value of author stored
in the browser cookie.
Still, you're correct that I didn't account for the
possibility of "$AuthId-$AuthId" appearing somehow through
interaction of browser cookies and this code... so go with whatever
works. :-)
Pm
More information about the pmwiki-users
mailing list