4

I have searched through forum and couldn't find answer to simple thing that I am trying to accompish

I created a new group under "Public" group and I provided that user a permission of "Administrator Login" in global configuration. User can login fine in Admin panel but In one of my system plugin, I want to check if the user has access to the backend. How can I accomplish that?

I tried following:

$user = JFactory::getUser();
$isroot = $user->authorise('core.admin');

but looks like that only detects if user is a super admin. My user with a special group permission by no means is a super user.

I will apreciate if someone can guide me in a right direction.

Thanks

5

Backend com_login component LoginController checks for core.login.admin permission. This is exactly the one you edited - Administrator Login.

So, change permission you are checking and you are good to go:

$user = JFactory::getUser();
$isroot = $user->authorise('core.login.admin');
0
0

You can achieve this through the Joomla group ID.

To find the Joomla group ID, go to Users -> Groups and check the last column.

Once you have the group ID, you can use this code or similar:

<?php
  //Get Group Memberships
  $user = JFactory::getUser();
  $groups = $user->get('groups');
  foreach($groups as $groupid) {
    if ($groupid == "8") $superadmin = "Yes";
    if ($groupid == "7") $admin = "Yes";
    if ($groupid == "2") $registered = "Yes";
  }
?>

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.