Add an extra protection to avoid having an empty group created
This commit is contained in:
parent
bd0bb466f0
commit
340ce958d9
|
@ -574,7 +574,7 @@ function local_user_set_groups($user, $new_groups = NULL ) {
|
||||||
|
|
||||||
/* determine which memberships to add */
|
/* determine which memberships to add */
|
||||||
foreach ($new_groups as $groupname) {
|
foreach ($new_groups as $groupname) {
|
||||||
if (in_array($groupname,$cur_groups))
|
if ($groupname == '' || in_array($groupname,$cur_groups))
|
||||||
continue;
|
continue;
|
||||||
$group = & $config['system']['group'][$groupindex[$groupname]];
|
$group = & $config['system']['group'][$groupindex[$groupname]];
|
||||||
$group['member'][] = $user['uid'];
|
$group['member'][] = $user['uid'];
|
||||||
|
|
Reference in New Issue