[dokuwiki] Re: Changing user to full name

> -----Original Message-----
> From: dokuwiki-bounce@xxxxxxxxxxxxx 
> [mailto:dokuwiki-bounce@xxxxxxxxxxxxx] On Behalf Of Oliver Geisen
> Sent: Wednesday, April 26, 2006 10:26 AM
> To: dokuwiki@xxxxxxxxxxxxx
> Subject: [dokuwiki] Re: Changing user to full name
> 
> Hello,
> 
> > I need to change the "Last Modified By" in the lower right corner  
> > to the
> > full name instead of the user name. I have tried to trace 
> back through
> This is done in
>    inc/template.php:tpl_pageinfo()
> 
> > the code to figure this out, but got confused after dereferencing  
> > about
> > five levels.
> It's not that bad. I find the code very structured and readable.

Not for me. I've seen more readable code entered into the Obfuscated C
Contest where the whole point is to make working code unreadable by
humans. Programmers that see objects only seem to do it by accident.

> The template calls tpl_pageinfo() directly.
> What you are looking for is coded there:
>      if($INFO['editor']){
>        print ' '.$lang['by'].' ';
>        print $INFO['editor'];
>      }
> 
> The $INFO['editor'] returns the IP-Adress, if changes made from an  
> unauthenticated user, or his User-ID. To get the users name from the  
> ID (IF it IS an ID and not an IP-Address) you have to make a lookup  
> in the userdb using getUserData-Function.
> 
> You COULD replace above code in template.php with:
> 
>    global $auth;
>    $userinfo = $auth->getUserData($INFO['editor']);
>    if ($userinfo['name']){
>      print $userinfo['name'];
>    }else{
>      print $INFO['editor'];
>    }
> 
> But you SHOULD NOT do this (to not taint the dokuwiki-core-code).
> Better implenent a new function in the template (maybe 
> "mytpl_pageinfo 
> ()") and copy the whole function there, then change the code and  
> change "tpl_pageinfo()" in main.php to "mytpl_pageinfo()".
> 
> 
> Oliver Geisen

Actually, its beginning to look like I need to duplicate the
lib/tpl/default tree and create my own custom template. Then it wouldn't
get trashed by future updates.

Thank you,

Bob McConnell

--
DokuWiki mailing list - more info at
http://wiki.splitbrain.org/wiki:mailinglist

Other related posts: