Log in

View Full Version : Random Secondary Group


lightwave
07-10-2006, 06:55 PM
I'm trying to add a modification for my forum to place all registered members in one of 4 secondary group.

The ID's of the secondary usergroups are 11, 12 ,13, 14.

Does anybody know what file the query is located in for inserting the values in the database when a new user registers. i looked at register.php and it's not there.

As for existing members, would this work?


$Secondary_Group = RANDOM(11,14);

$member= $db->query_first("SELECT membergroupids FROM " . TABLE_PREFIX . "user WHERE username='" . $db->escape_string($vbulletin->GPC['username']) . "'"))
if ($member['groupids'])
{
}
else
{
$db->query_write("UPDATE " . TABLE_PREFIX . "users SET membergroupids=$Secondary_Group WHERE userid=" . $vbulletin->userinfo['userid']" ");

}

Reeve of shinra
07-10-2006, 07:10 PM
I believe something like this has been released already... try searching for Harry Potter in the release forums.

lightwave
07-10-2006, 07:15 PM
Yes, but that only modifies the Primary Usergroup.

Will simply adding things code of text input it in the database?

$membergroupidsrandom = rand(11,14);
$userdata->set('membergroupids', $membergroupidsrandom);