Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Fixed remove_teacher, so that a removed teacher is also removed from any

groups they belong to.
  • Loading branch information...
commit 5ec9237d2b6490e9ffb26c39657461561a8f790d 1 parent 908b8b9
mchurch authored
Showing with 11 additions and 0 deletions.
  1. +11 −0 lib/moodlelib.php
View
11 lib/moodlelib.php
@@ -965,6 +965,17 @@ function remove_teacher($userid, $courseid=0) {
delete_records("forum_subscriptions", "forum", $forum->id, "userid", $userid);
}
}
+
+ /// Next if the teacher is not registered as a student, but is
+ /// a member of a group, remove them from the group.
+ if (!isstudent($courseid, $userid)) {
+ if ($groups = get_groups($courseid, $userid)) {
+ foreach ($groups as $group) {
+ delete_records("groups_members", "groupid", $group->id, "userid", $userid);
+ }
+ }
+ }
+
return delete_records("user_teachers", "userid", $userid, "course", $courseid);
} else {
delete_records("forum_subscriptions", "userid", $userid);
Please sign in to comment.
Something went wrong with that request. Please try again.