My customer requested that certain parts of VirtueMart only would be accessible if you are registered user. This is pretty easy when you have found the proper object to call. You need to retrieve the user object and then check if it has an ID:
$user =& JFactory::getUser();
if ($user->id > 0)
{ /* do code */}
That's all to it. When you have gotten the user-object you can of course access a whole lot more information which is documented in the user class. Below are two interesting links if you need to find out more.
http://api.joomla.org/Joomla-Framework/User/JUser.html
http://www.jlleblanc.com/joomla/Tutorials/JUser_tutorial_for_Joomla!_1%115/
No comments:
Post a Comment