What table is used to hold the list of users and the usergroups they belong to?
I think that is the best way to ask this question
I have been able to dumo the usergroup table values into an array that I created but as i understand the way things work the usergroupid have a value this value is used as a index into a table that holds the data which will determine the user groups the user belongs to my problem is two fold what is the name of this table that holds this information and what fields are used to traverse the table to get the actaul user groups the logon user belongs to.
Here is my test script so far
PHP Code:
global $myusergroup;
$myusergroup = array();
$usergroups = $vbulletin->db->query_read("SELECT usergroupid, title FROM " . TABLE_PREFIX . "usergroup ORDER BY title");
while ($usergroup = $vbulletin->db->fetch_array($usergroups))
{
$myusergroup["$usergroup[usergroupid]"] = $usergroup['title'];
}
ob_start();
foreach ($myusergroup AS $myvaluegroup)
{
$myusergroup["$usergroup[usergroupid]"] = $usergroup['usergroupid'];
$myusergroup["$usergroup[title]"] = $usergroup['title'];
}
foreach ($myusergroup AS $myvaluegroup)
{
echo($myvaluegroup . "<br />");
}
// ob_end_flush();
ob_end_clean();
unset($usergroup);
$vbulletin->db->free_result($usergroups);
THANKS
Frank H. Shaw
--------------- Added [DATE]1232766083[/DATE] at [TIME]1232766083[/TIME] ---------------
After strugleing with the following script below the membergrpoupid does not display any contact now this is because it does not contain any vaue - which means that I am nit understand how the informstion in the user table and usergroup and i must ask again - HOW IS THE USERGROUP LINKED BACK TO THE USER. WHAT FIELD IS THE USERGROUPS STORED IN AND HOW? PLEASE EXPLAN THIS RELATIONSHIP.
PHP Code:
global $myuseruser;
$myuseruser = array();
$myusers = $vbulletin->db->query_read("SELECT userid, username, usergroupid, membergroupids FROM " . TABLE_PREFIX . "user ORDER BY userid");
while ($myuser = $vbulletin->db->fetch_array($myusers))
{
$myuseruser["$myuser[userid]"] = $myuser['userid'];
$myuseruser["$myuser[username]"] = $myuser['username'];
$myuseruser["$myuser[usergroupid]"] = $myuser['usergroupid']; // No Data here and should be
$myuseruser["$myuser[membergrpoupid]"] = explode(',', $myuser['membergroupids']); // No data here and should be
}
foreach ($myuseruser AS $myvalueuser)
{
echo($myvalueuser . "<br />");
}
// print_r($myuseruser);
THANKS
Frank H. Shaw