Monday, February 09, 2009

Simple Joomla! Hack to hide links from registered users.

Last week when I was doing some changes to one of my websites, I came across a requirement to display "Login and Registration" link only for guest users, once the members logged in to their member area, it should be a "Logout" link.

Unfortunately Joomla! Core doesn’t support that feature, which I think most of you might also need badly. But it was a very simple hack, and will be useful for Joomla! devs who are looking for the same functionality. Here I'm posting a small PHP code which does the Job.

if (!($my->id)) {
echo "
Welcome! Sign in Or Register.
"; }else{ echo "
Welcome! ".$my->name."| Logout.
"; }