Quote:
Originally Posted by bananalive
PHP Code:
if ($complete)
{
/*replace 45 with appropriate question hash*/
$userinfo=fetch_userinfo($qo[45]);
$user=$userinfo;
/*replace 18 with choosen usergroupid you want to add them to*/
$newmembergroupid = '18';
$user['membergroupids']=explode(',',$user['membergroupids']);
foreach($user['membergroupids'] AS $mi => $mii)
{
/*replace 17 with usergroupid you want to remove them from*/
if ($mii=='17')
{
unset($user['membergroupids']['$mi']);
}
}
$display_usergroup = $newmembergroupid;
$user['membergroupids']=implode(',',$user['membergroupids']);
$userdata =& datamanager_init('User', $vbulletin, ERRTYPE_STANDARD);
$userdata->set_existing($userinfo);
$userdata->set('membergroupids', $user['membergroupids']);
$userdata->set_usertitle($user['customtitle'] ? $user['usertitle'] : '', false, $display_usergroup, true, true);
$userdata->save();
|
Hey Banana, I appreciate your time and effort on this. Still not working though. I did add the missing } at the end, so that wasn't my issue. Did it work for you? I changed the 45 to 1 and nothing. The form gets submitted, but the user doesn't get removed or added to anything. On a side note, don't enter anything but a number into the question you choose for this code. I tried that and WOW. The magnitude of data returned was never ending.