[dokuwiki] Re: Changing user to full name

  • From: Oliver Geisen <oliver.geisen@xxxxxxxxxxxx>
  • To: dokuwiki@xxxxxxxxxxxxx
  • Date: Wed, 26 Apr 2006 16:26:04 +0200

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.

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 _____________________________ Systemadministrator Kreisboten Verlag Mühlfellner KG 82362 Weilheim i. Ob. Tel. 0881/686-904 Fax 0881/686-74


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

Other related posts: