User Login and Logout Links in tpl.php

Public

Create user login links with customized messages for user logged in. Also includes the registration link for anonymous users.

</> CopyGet raw version
php
  1. <!--.user-links-->
  2. <div class="user-links">
  3. <?php global $user; ?>
  4. <?php if (!user_is_anonymous()): ?>
  5.  
  6. <?php print l($user->name,'user/'.$user->uid); ?> | logout <?php print l($user->name,'user/logout'); ?>
  7.  
  8. <?php else : ?>
  9. Welcome Guest! <?php print l("Register","user/register"); ?> | <?php print l("Login","user"); ?>
  10. <?php endif; ?>
  11. </div>
  12. <!--.user-links End-->