[support] displaying who you are logged in as

andy baxter andy at earthsong.free-online.co.uk
Sat Oct 10 20:02:47 UTC 2009


Martin Hooper wrote:
> Is there a module that will display the logged in user?
>   
I just added the following code into a suitable place in my page.tpl.php:

               <?php if ($user->uid): ?>
                 Welcome <?php print $user->name; ?>
                 (<a href="<?php print base_path() ?>logout/" >Log out</a>)
               <?php else:  ?>
                 <a href="<?php print base_path() ?>user/" >Log in / 
register</a>
               <?php endif; ?>

This prints 'Welcome <user name>' plus a log in /out link.

If that's any help?

andy


More information about the support mailing list