I have a plugin that saves users into a registration group like:
if (craft()->request->isSiteRequest()) {
//etc
$groupId = '1';
craft()->userGroups->assignUserToGroups($user->id, $groupId);
}
However if i listen for the user save event for the control panel:
if (craft()->request->isCpRequest()) {
//etc
$groupId = '1';
craft()->userGroups->assignUserToGroups($user->id, $groupId);
}
This doesnt work. I also tried passing an array as groupId(s) but the group permission never gets ticked.
Is there another way of assigning a new user saved in the back end to a specific permission group?