Solved

Joomla 2.5 logged in user question

Posted on 2012-12-28
3
363 Views
Last Modified: 2013-01-06
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?
0
Comment
Question by:tf2012
3 Comments
 
LVL 13

Accepted Solution

by:
Abhijeet Rananaware earned 250 total points
ID: 38735918
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

0
 
LVL 25

Assisted Solution

by:lenamtl
lenamtl earned 250 total points
ID: 38747692
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.
0
 
LVL 1

Author Closing Comment

by:tf2012
ID: 38748347
thank you!
0

Featured Post

Announcing the Most Valuable Experts of 2016

MVEs are more concerned with the satisfaction of those they help than with the considerable points they can earn. They are the types of people you feel privileged to call colleagues. Join us in honoring this amazing group of Experts.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Change Joomla Logo Graphic This tutorial goes over the steps to change the Joomla Logo in the template you are using. For this example we will be assuming you are using the rhuk_milkyway Joomla Template which is installed by default. You will …
Welcome Friends, This is the tutorial for how to create new simple module in joomla 1.5. In the module has two important files. One is XML file and another file is PHP controller file. First you need to create the XML file. (CODE) …
Although Jacob Bernoulli (1654-1705) has been credited as the creator of "Binomial Distribution Table", Gottfried Leibniz (1646-1716) did his dissertation on the subject in 1666; Leibniz you may recall is the co-inventor of "Calculus" and beat Isaac…
The Email Laundry PDF encryption service allows companies to send confidential encrypted  emails to anybody. The PDF document can also contain attachments that are embedded in the encrypted PDF. The password is randomly generated by The Email Laundr…

839 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question