How can I assign a different usergroup to the active user with php?
I believe I can get the active user by using the following code:
I believe I can get the active user by using the following code:
13 years 2 months ago #117035
Try this code:
replace groupid with the proper value, you should pass an array because a user can be assigned to multiple groups.
$userGroups = array(groupid);
$user->set('groups', $userGroups);replace groupid with the proper value, you should pass an array because a user can be assigned to multiple groups.
Multiple Extra Fields Groups for K2
AutoMeta for K2
Chained Fields for K2
More K2 Extensions In My Extensions Store
AutoMeta for K2
Chained Fields for K2
More K2 Extensions In My Extensions Store