Hello,
I'm trying to reproduce the request to change a members primary group after successfully submitting a form.
I believe originally
discussed here
Essentially I am trying to change a members group from 2 to {something else} ,and update their display_usergroup, however, when I attempt to incorporate the code, I receive the following:
Here is the code I attempted to use: (I first tried it in its original state, them tried changing line 4 to its current iteration - It was:
PHP Code:
$userinfo=fetch_userinfo($qo[1]);
)
PHP Code:
if ($complete)
{
/*replace 45 with appropriate question hash*/
$userinfo=fetch_userinfo($qo_1);
$user=$userinfo;
/*replace 18 with choosen usergroupid you want to add them to*/
$newmembergroupid = '57';
$user['membergroupids']=explode(',',$user['membergroupids']);
foreach($user['membergroupids'] AS $mi => $mii)
{
/*replace 17 with usergroupid you want to remove them from*/
if ($mii==2)
{
unset($user['membergroupids'][$mi]);
}
}
$user['membergroupids'][]=$newmembergroupid;
$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->save();
}
Thank you very much for any help.