[dokuwiki] Re: showing author name on every page

  • From: "Bob McConnell" <rvm@xxxxxxxxx>
  • To: <dokuwiki@xxxxxxxxxxxxx>
  • Date: Tue, 4 Sep 2007 09:19:49 -0400

Helge Kaltenbach wrote:
> Bob McConnell wrote:
>> Helge Kaltenbach wrote:
>>> Hello list,
>>>
>>> can someone tell me how I force my wiki to show the author 
>>> name on every
>>> page? Currently you can't add any pages to the wiki, if your not
>>> logged in.
>>> Any ideas?
>>>
>>> thanks in advance
>>> helge
>> 
>> I did that to our company wiki a while ago. I had to replace the
>> function in the page footer that shows the last changed 
>> date and user ID
>> with a function that looks up the user name and inserts it 
>> in place of
>> the ID. However, that still requires the user be logged in 
>> when updating
>> the page, otherwise it won't know what user ID or name to 
>> insert. In our
>> case, the wiki will allow anyone to view pages, but you 
>> have to log in
>> before you can edit or add pages. We tried it the other 
>> way, but it was
>> not possible to map the IP addresses to users, since the DHCP server
>> doesn't always give everyone the same IP and a few machines 
>> that were
>> being used are shared by several users.
>> 
>> I can't access that wiki from home, but can post my changes 
>> when I get
>> back to the office on Tuesday.
> 
> Sounds great, waiting till Tuesday then, thanks!
> 
> helge

The "last modified" line is printed by the function tpl_pageinfo() in
inc/template.php. In order to change that, I created a custom template
set and duplicated that function as mytpl_pageinfo() in main.php. Then I
changed mytpl_pageinfo() to show the full name. So this:

    if($INFO['editor']){
      print ' '.$lang['by'].' ';
      print $INFO['editor'];
    }

became:

    global $auth;
    $userinfo = $auth->getUserData($INFO['editor']);
    if($userinfo['name']){
      print ' '.$lang['by'].' ';
      print $userinfo['name'];
    }

Then in the footer section of main.php, replace the call to
tpl_pageinfo() with mytpl_pageinfo().

HTH,

Bob McConnell
Principal Communications Programmer
The CBORD Group, Inc.
61 Brown Road
Ithaca NY, 14850
Phone 607 257-2410
FAX 607 257-1902
Email rvm@xxxxxxxxx
Web www.cbord.com
--
DokuWiki mailing list - more info at
http://wiki.splitbrain.org/wiki:mailinglist

Other related posts: