Permalink
Browse files

Bug fix: don't allow users to be inserted in several groups

  • Loading branch information...
1 parent 499d1a4 commit 3e2ac6a0508bec534af7827f2befde649619dcd6 fiedorow committed Feb 24, 2004
Showing with 4 additions and 2 deletions.
  1. +3 −2 admin/uploaduser.php
  2. +1 −0 lang/en/error.php
View
@@ -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;
View
@@ -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';

0 comments on commit 3e2ac6a

Please sign in to comment.