From 10d96e29639d9d739fc4e4e1d7c27f8a031b63f5 Mon Sep 17 00:00:00 2001 From: moodler Date: Mon, 21 Mar 2005 08:33:24 +0000 Subject: [PATCH] WHen a student enrols via a group password, make sure they are in the group immediately bug 2780 --- enrol/enrol.class.php | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/enrol/enrol.class.php b/enrol/enrol.class.php index 544de7ada4d..05453a11853 100644 --- a/enrol/enrol.class.php +++ b/enrol/enrol.class.php @@ -227,10 +227,14 @@ function check_entry($form, $course) { error("An error occurred while trying to enrol you."); } - if (($groupid !== false ) and (!add_user_to_group($groupid, $USER->id)) ) { - error("An error occurred while trying to add you to a group"); + if ($groupid !== false) { + if (add_user_to_group($groupid, $USER->id)) { + $USER->groupmember[$course->id] = $groupid; + } else { + error("An error occurred while trying to add you to a group"); + } } - + $subject = get_string("welcometocourse", "", $course->fullname); $a->coursename = $course->fullname; $a->profileurl = "$CFG->wwwroot/user/view.php?id=$USER->id&course=$course->id";