Hi,
hello,
I have a problem with a ChronoConnectivity connection.My joomla have 10 user groups and each group contains 5 users. I made a form to enter requests. later that user should see only the demands of his group. I created the connection and everything works fine, except that everyone sees everything. how can I make sure to show each user only requests related to his group?
hello,
I have a problem with a ChronoConnectivity connection.My joomla have 10 user groups and each group contains 5 users. I made a form to enter requests. later that user should see only the demands of his group. I created the connection and everything works fine, except that everyone sees everything. how can I make sure to show each user only requests related to his group?
Hi jonnyblog1976,
You'll need to add some code in the WHERE box to check the current user's group and filter the results to match.
Bob
You'll need to add some code in the WHERE box to check the current user's group and filter the results to match.
Bob
Hi Bob thank you,
how do i get the group of the active user?
using JFactory::getUser()?
how do i get the group of the active user?
using JFactory::getUser()?
Hi jonnyblog1976,
In Joomla! 1.5 that will do it because the user can only belong to one group and $user->gid will give it to you.
Joomla! 1.6+ is more complex because the user can belong to many groups. I think this is the right code:
Bob
In Joomla! 1.5 that will do it because the user can only belong to one group and $user->gid will give it to you.
Joomla! 1.6+ is more complex because the user can belong to many groups. I think this is the right code:
<?php
$user =& JFactory::getUser();
$user_groups = $user->getAuthorisedGroups();
?>
This will return an array of groups though so you still need to check if the group you are interested in is in the array:<?php
if ( in_array( 'some_group', $user_groups ) ) {
// do something
}
?>
Bob
Hi Bob thank you for your help.
Jonny
Jonny
hi Bob
from which joomla table getAuthorisedGroups() take the data?
and how to see this data: <?php echo $user_groups->id; ?> ?
every user have only one group
from which joomla table getAuthorisedGroups() take the data?
and how to see this data: <?php echo $user_groups->id; ?> ?
every user have only one group
This topic is locked and no more replies can be posted.