Skip to content

Commit

Permalink
Merged MDL-13152 from 1.9
Browse files Browse the repository at this point in the history
  • Loading branch information
moodler committed Feb 14, 2008
1 parent 874e184 commit b225cf3
Showing 1 changed file with 10 additions and 2 deletions.
12 changes: 10 additions & 2 deletions admin/uploaduser.php
Original file line number Diff line number Diff line change
Expand Up @@ -656,8 +656,16 @@
// group exists?
$addgroup = $user->{'group'.$i};
if (!array_key_exists($addgroup, $ccache[$shortname]->groups)) {
$upt->track('enrolments', get_string('unknowgroup', 'error', $addgroup), 'error');
continue;
// if group doesn't exist, create it
$newgroupdata = new object();
$newgroupdata->name = $addgroup;
$newgroupdata->courseid = $ccache[$shortname]->id;
if ($ccache[$shortname]->groups[$addgroup]->id = groups_create_group($newgroupdata)){
$ccache[$shortname]->groups[$addgroup]->name = $newgroupdata->name;
} else {
$upt->track('enrolments', get_string('unknowngroup', 'error', $addgroup), 'error');
continue;
}
}
$gid = $ccache[$shortname]->groups[$addgroup]->id;
$gname = $ccache[$shortname]->groups[$addgroup]->name;
Expand Down

0 comments on commit b225cf3

Please sign in to comment.