mirror of
https://github.com/moodle/moodle.git
synced 2025-04-24 18:04:43 +02:00
MDL-12789 - dont unnecessarily iterate over all groups
This commit is contained in:
parent
e9c0fa35f4
commit
25c3f91a52
@ -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;
|
||||
}
|
||||
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user