For doing this, we must get the group id. They are as follows:
Public : 0
Registered : 1
Special : 2
Users that have access to the backend fall under the Special group.
The following code will check the group id of the current user and display a message if user is not of 'Special' type.
$user = JFactory::getUser();
$userGID = $user->get('gid');
if ($userGID != 2)
{
echo "You do not have the necessary permissions to perform this action.";
}
No comments:
Post a Comment