Skip to content

Commit

Permalink
GH-745 Fix group enrolment
Browse files Browse the repository at this point in the history
Fix incorrect comparison (group name vs group ID). Also: do not try to
users that are already members.
  • Loading branch information
davidszkiba committed Nov 7, 2024
1 parent b271835 commit ef17eba
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion classes/catquiz.php
Original file line number Diff line number Diff line change
Expand Up @@ -1979,7 +1979,10 @@ public static function enrol_and_create_message_array(
$groupsofcourse = groups_get_all_groups($courseid);
foreach ($groupsofcourse as $existinggroup) {
foreach ($groupstoenrol[$catscaleid] as $newgroup) {
if ($existinggroup->id == $newgroup) {
if ($existinggroup->name == $newgroup) {
if (groups_is_member($existinggroup->id, $userid)) {
continue;
}
$groupmember = groups_add_member($existinggroup->id, $userid);
if ($groupmember) {
$data = [];
Expand Down

0 comments on commit ef17eba

Please sign in to comment.