[pmwiki-users] setting $Author with $AuthId as prefix

Patrick R. Michaud pmichaud at pobox.com
Tue Jan 23 07:08:52 CST 2007


On Tue, Jan 23, 2007 at 10:49:43AM -0000, marc wrote:
> Patrick R. Michaud said...
> > Simply be sure to also (re)set $AuthorLink when changing $Author:
> > 
> >     include_once("$FarmD/scripts/author.php");
> >     include_once("$FarmD/scripts/authuser.php");
> >     $Author = "$AuthId-" . preg_replace('/^[^-]*-/', '', $Author);
> >     $AuthorLink = "[[~$Author]]";
> 
> 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]]";

Thanks!

Pm




More information about the pmwiki-users mailing list