Hi,
Where can I find a relation (in database tables) between user and his related group. I have created a new group and then created two new users under it. Now How do i find the group name to which these two new users belong to.
-
☆ A M B ☆
- 24,524 Posts
The webgroup_access table contains the relation, it has two fields, one for the user ID and one for the group ID. Here’s the code the web_access_permissions.dynamic.php file uses when it displays the user assigned to the groups in the Manager.
$sql = 'SELECT '.
'groupnames.*, '.
'users.id AS user_id, '.
'users.username user_name '.
'FROM '.$modx->getFullTableName('webgroup_names').' AS groupnames '.
'LEFT JOIN '.$modx->getFullTableName('web_groups').' AS groups ON groups.webgroup = groupnames.id '.
'LEFT JOIN '.$modx->getFullTableName('web_users').' AS users ON users.id = groups.webuser '.
'ORDER BY groupnames.name';
:-) Thanks for your help.
Your answer helped a lot. Can you please provide some resource wherein I can study these relationships (foreign key assignments) in modxcms database.