Skip to content

Commit

Permalink
MDL-12789 - dont unnecessarily iterate over all groups
Browse files Browse the repository at this point in the history
  • Loading branch information
poltawski committed Jan 1, 2008
1 parent e9c0fa3 commit 25c3f91
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions enrol/manual/enrol.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}


Expand Down

0 comments on commit 25c3f91

Please sign in to comment.