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

Kathryn Andersen kat_lists at katspace.homelinux.org
Tue Jan 23 19:48:34 CST 2007


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.
I've fallen back to something very similar to what I started with, now.

    if ($Author) {
        if (strstr($Author, '-') != false) {
            $Author = "$AuthId-" . preg_replace('/^[^-]*-/', '', $Author);
        } else if ($Author != $AuthId) {
            $Author = $AuthId . '-' . $Author;
        } else {
            $Author = $AuthId;
        }
    } else {
        $Author = $AuthId;
    } 

I've updated PmWiki/AuthUser accordingly.

Kathryn Andersen
-- 
 _--_|\     | Kathryn Andersen	<http://www.katspace.com>
/      \    | 
\_.--.*/    | GenFicCrit mailing list <http://www.katspace.com/gen_fic_crit/>
      v     | 
------------| Melbourne -> Victoria -> Australia -> Southern Hemisphere
Maranatha!  |	-> Earth -> Sol -> Milky Way Galaxy -> Universe




More information about the pmwiki-users mailing list