1

I simply want to make a module visible dependent on whether a user belongs to a custom set of groups - including NOT visible if (s)he belongs to a particular group(s). For example, adverts show for public and registered but not a custom "premium" group. A shoutbox should appear for registered and premium but not "not logged in". Thus, the "guest" and "special" groups are pretty useless as far as I can tell. Am I missing something really simple?

If I have to use a 3rd party component/module to achieve this then a free or cheap one would be most beneficial.

Thanks.

2 Answers 2

1

One way to achieve this is to edit and create new access levels. To cover up the examples you gave in the question, the following could work:

You need to get the guests out of the root parent group called Public. You can do this by the following three steps:

  1. Using the User Manager, create a new group called "Guest" with Public as parent.
  2. Open up the User Manager Options.
  3. Change Guest User Group to your new group Guest.

The guests on your site will from now on be put into the Guest group. Now you could create a access level for the advert. So create a new access level, name it something like "Non premium users" and add Guest and Registered. Now apply this access level to the module and it should work. Note that the premium group cannot have Registered as a parent.

Next is the access level for the shoutbox. I see two options for this access level. One of them is to create a new access level and add Registered and Premium to it. A simpler approach though is to add the Premium group to the already existing access level called Registered.

Helpful ACL Links:

0

None of the ACL levels work 100% of the time for me, I had to hack the template I was using and add in some code...

<?php  

// make sure user is an accepted user group 
jimport( 'joomla.user.helper' );
$user =& JFactory::getUser();
$userId = $user->get( 'id' );
$groups = JUserHelper::getUserGroups($userId);

// print_r($groups); 
/* 
3 Author
4 Editor
5 Publisher
6 Manager
7 Administrator
8 Super Users
*/ 

$menu = '' ;
if (in_array("3", $groups)) {
       // echo "<!-- Author Group Found! -->";
        // echo '<!-- USER ID: ' . $userId . ' -->';
        $menu .= "
        <a href='http://yourdomain.com/authors-area'>Authors Area</a> 
        " ;
} elseif(in_array("4", $groups)) { 
$menu .= "
        <a href='http://yourdomain.com/editors-area'>Editors Area</a> 
        " ;
} elseif(in_array("5", $groups)) { 
$menu .= "
        <a href='http://yourdomain.com/publishers-area'>Publishers Area</a> 
        " ;
} elseif(in_array("6", $groups)) { 
$menu .= "
        <a href='http://yourdomain.com/managers-area'>Managers Area</a> 
        " ;
} elseif(in_array("7", $groups)) { 
$menu .= "
        <a href='http://yourdomain.com/administrators-area'>Administrators Area</a> 
        " ;
} elseif(in_array("8", $groups)) { 
$menu .= "
        <a href='http://yourdomain.com/superusers-area'>Super Users Area</a> 
        " ;
} else {
    $null = '' ; ;
    }
?>

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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