[dokuwiki] Re: Changing user to full name

> -----Original Message-----
> From: dokuwiki-bounce@xxxxxxxxxxxxx 
> [mailto:dokuwiki-bounce@xxxxxxxxxxxxx] On Behalf Of Chris Smith
> Sent: Wednesday, April 26, 2006 2:17 PM
> To: dokuwiki@xxxxxxxxxxxxx
> Subject: [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.


I have been trying to read the documentation, but it assumes a working
knowledge of objects and classes, which I don't have. My brief foray
into Visual C++ was not at all helpful in figuring this out. After 25
years of assembler and embedded programming, OOP doesn't make much sense
at all.


> >   
> >> 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.


I am looking for the last editor's full name, not the logged in user. So
I think he was right. It is still at least one lookup away. Users must
log in before they can edit, so IP addresses should not be an issue.


> >> 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.


You are assuming everyone knows and trusts darcs, not a very reasonable
assumption. I have no idea what it is nor how it works, and I have not
had time to look at anything outside of what I actually need to get
working for this project. I still have to do real work for paying
customers most of the day.


> > 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.

Is there any way to test changes to a template without switching the
entire site? I need to make sure my alterations actually work correctly
before committing them to the live pages.

Thank you,

Bob McConnell

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

Other related posts: