Bug fix: don't allow users to be inserted in several groups
This commit is contained in:
@@ -209,8 +209,9 @@
|
||||
for ($i=0; $i<5; $i++) {
|
||||
if ($courseid[$i] && $groupid[$i]) {
|
||||
if (record_exists("user_students","userid",$user->id,"course",$courseid[$i])) {
|
||||
if (record_exists("groups_members","groupid",$groupid[$i],"userid",$user->id)) {
|
||||
notify('-->' . get_string('addedtogroup','',$addgroup[$i]));
|
||||
$usergroup = user_group($courseid[$i],$user->id);
|
||||
if ($usergroup) {
|
||||
notify('-->' . get_string('groupalready','error',$usergroup->name));
|
||||
} else {
|
||||
$group_member->groupid = $groupid[$i];
|
||||
$group_member->userid = $user->id;
|
||||
|
||||
@@ -4,6 +4,7 @@
|
||||
$string['coursegroupunknown'] = 'Course corresponding to group $a not specified';
|
||||
$string['erroronline'] = 'Error on line $a';
|
||||
$string['fieldrequired'] = '\"$a\" is a required field';
|
||||
$string['groupalready'] = 'User already belongs to group $a';
|
||||
$string['groupunknown'] = 'Group $a not associated to specified course';
|
||||
$string['invalidfieldname'] = '\"$a\" is not a valid field name';
|
||||
$string['missingfield'] = 'Field \"$a\" is missing';
|
||||
|
||||
Reference in New Issue
Block a user