We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 10522
    • 6 Posts
    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.
      • 28042 ☆ 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';
        Studying MODX in the desert - http://sottwell.com
        Tips and Tricks from the MODX Forums and Slack Channels - http://modxcookbook.com
        Join the Slack Community - http://modx.org
        • 10522
        • 6 Posts
        :-) 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.