diff --git a/enrol/manual/enrol.php b/enrol/manual/enrol.php index 46030f87b1ee9..1f97c66fae1b3 100644 --- a/enrol/manual/enrol.php +++ b/enrol/manual/enrol.php @@ -188,15 +188,16 @@ function check_entry($form, $course) { * @param password the submitted enrolment key */ function check_group_entry ($courseid, $password) { - $ingroup = false; - if (($groups = groups_get_all_groups($courseid))) { + + if ($groups = groups_get_all_groups($courseid)) { foreach ($groups as $group) { if ( !empty($group->enrolmentkey) and (stripslashes($password) == $group->enrolmentkey) ) { - $ingroup = $group->id; + return $group->id; } } } - return $ingroup; + + return false; }