Abe1,
Just curious, for adding to a Membergroupids, could we just reuse the code you gave me for checking to see if someone is in a Membergroup and then instead of "print_no_permission();" -- you could instead say add that membergroupid to this user?
Something like this (12 being the secondary member group I want to add the user to if they answer correctly):
PHP Code:
$check1 = explode("|", '12');
$check3 = explode(",",$vbulletin->userinfo[membergroupids]);
foreach ($check1 AS $check2)
{
if ($check2 == $vbulletin->userinfo[usergroupid])
{
$is++;
}
foreach ($check3 AS $check4)
{
if ($check2 == $check4)
{
$is++;
}
}
}
if (!($is))
{
$check3->set('membergroupids', $check3);
}
Not to sure what to put in that final if statement, but was hoping you would. I've been testing a few things with no luck.
The other thing I tried was something Amy had posted for adding to a secondary group. Sadly it gave a Fatal error: Call to a member function on a non-object in ..../newthread.php(68) : eval()'d code on line 403. I know I missed setting a variable, but just not sure what one and what to set there.
PHP Code:
$membergroupids = $userdata->fetch_field('membergroupids');
if ($membergroupids)
{
$membergroupids = $membergroupids . ", 12";
}
else
{
$membergroupids = 12;
}
$userdata->set('membergroupids', $membergroupids);
Anyhow, I'll take what I can get. Thanks again for your help on the first problem.