Joomla 2.5 logged in user question

tf2012
tf2012 used Ask the Experts™
on
I want to display a link only for users logged in and part of the administrator group.  The administrator group seems to be group id 7 in J2.5

kind of like this

if ($userGroup = 'admin') {
 
show link

}

Anyone know the syntax would look for Joomla 2.5?
Comment
Watch Question

Do more with

Expert Office
EXPERT OFFICE® is a registered trademark of EXPERTS EXCHANGE®
Web & Mobile Developer
Commented:
You need to access joomla user object.

To access user object use following code.After loading userobject in user variable you can acess usertype and add conditions according to user type as you need.
$user =& JFactory::getUser();
if($user->usertype =="Super Administrator")
{
  //code for admin
}

Open in new window

If the link is a menu item just select the appropriate group access.

For content you can use:
http://ninjaforge.com/extensions/ninja-access-plugin
Ninja Access - Plugin allows you to hide or show portions of content depending on the access level of the viewer.

Author

Commented:
thank you!

Do more with

Expert Office
Submit tech questions to Ask the Experts™ at any time to receive solutions, advice, and new ideas from leading industry professionals.

Start 7-Day Free Trial