I'm trying to remove a secondary usergroup.
I used the following code to add it:
However, removing it doesn't work this way, as the usergroup I'm trying to remove was added via the admin CP (actually, it was imported direct into DB from vBulletin export)
I could just get the field from the DB, explode the usergroupid array, and remove it, glue it back and update the field, but I'm guessing the general permissions on the forums won't be updated this way.
I used the following code to add it:
PHP:
/** @var \XF\Service\User\UserGroupChange $userGroupChange */
$userGroupChange = \XF::service('XF:User\UserGroupChange');
$userGroupChange->addUserGroupChange($user->user_id, '<a key describing the change>', [<array of user group ids to add to>]);
However, removing it doesn't work this way, as the usergroup I'm trying to remove was added via the admin CP (actually, it was imported direct into DB from vBulletin export)
I could just get the field from the DB, explode the usergroupid array, and remove it, glue it back and update the field, but I'm guessing the general permissions on the forums won't be updated this way.