You can use the script below in your site.html template

<html xmlns="http://www.w3.org/1999/xhtml";
      xmlns:py="http://genshi.edgewall.org/"; py:strip="">
 <head py:match="head" py:attrs="select('@*')">
  ${select('*')}
  <script type="text/javascript">
   jQuery(document).ready(function($) {
     $('#metanav li.first:contains("logged in as")').each(function() {
       var path = $('#mainnav li.first a').attr('href').split('/')[1];
       var user = $(this).text().split(' ').pop();
       var link = '<a href="/' + path + '/wiki/' + user + '">' + user
+ '</a>';
       $(this).html('logged in as ' + link);
       return false;
     });
   });
  </script>
 </head>
</html>

http://trac-hacks.org/wiki/LoggedInScript


On Jun 11, 4:20 pm, DG <[email protected]> wrote:
> First of all Trac rocks!
>
> Now for the problem.  I have looked throughout the documentation and
> was wondering if/how I could use the currently logged in user in the
> body of the wiki pages.  I'm not sure if this is in the macro's domain
> and if that macro is provided, or if it is somewhere else.
>
> As an example, I would like to use this with the TicketQuery macro and
> provide a link to the logged in user's tickets.  OR another use case
> would simply be
> "Welcome %s to Trac!" % user (in python lingo)
>
> Thanks,
> Danny G

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Trac 
Users" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.com/group/trac-users?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to