In Drupal, the default Log In and Log Out in the main ‘navigation’ menu may be less than desirable. If you use the navigation for other categories, it’s nice to keep the functions like ‘Log In’ separate for an easier user experience.
The following code will allow you to easily add dynamic log in / log out text in the footer, depending on whether you’re logged in or not. It will also greet you if you’re signed in, so it’s obvious what your log in status is. Just replace the URLs with your domain and customize whatever footer links you want. <?php global $user;
if ($user->uid) {
print t("<strong style='color:#FFFF00;'>Hi @name!</strong> | <a href='http://www.yourdomain.com/?q=logout'>Log Out</a> | <a href='http://www.yourdomain.com/privacy.php' >Privacy Policy</a>", array('@name' => $user->name));}
else
{
print t("<a href='http://www.yourdomain/?q=user' style='color:#FFFF00;'>Log In / Register</a> | <a href='http://www.yourdomain.com/privacy.php' >Privacy Policy</a>");
}
?>
Within the admin’s ‘block’, just edit the footer and paste the above in. You can then disable the ‘Log Out’ menu item in the main ‘navigation’.
I hope this helps someone with their project.
Thanks !!! That was concise and simple…