[dokuwiki] Re: Changing user to full name

Bob McConnell wrote:
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.
Perhaps if you tried reading the documentation. *hint* look for the page on Developing Templates. And check out the $INFO variable.
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.
Accurate, but not the right answer. See the documentation. The users full name is already available.
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
You could install darcs. It will allow you to record your changes as patches and to replay your patches against an update - if there are no conflicts there is nothing more to do.
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.
You should always do this. Its a simple copy of the /tpl/default directory, give it a new name and then change the configuration to use the new template. Shouldn't take more than 2 minutes if that long.
--
DokuWiki mailing list - more info at
http://wiki.splitbrain.org/wiki:mailinglist

Other related posts: