Permalink
Browse files

MDL-25936 fixed user upload when manual plugin not first

  • Loading branch information...
1 parent 5a7f931 commit 4cb02426ff0ecc4f917ea9812ba96022eaa2feb8 @skodak skodak committed Jan 12, 2011
Showing with 10 additions and 4 deletions.
  1. +10 −4 admin/uploaduser.php
View
@@ -668,10 +668,16 @@
$courseid = $ccache[$shortname]->id;
$coursecontext = get_context_instance(CONTEXT_COURSE, $courseid);
if (!isset($manualcache[$courseid])) {
- if ($instances = enrol_get_instances($courseid, false)) {
- $manualcache[$courseid] = reset($instances);
- } else {
- $manualcache[$courseid] = false;
+ $manualcache[$courseid] = false;
+ if ($manual) {
+ if ($instances = enrol_get_instances($courseid, false)) {
+ foreach ($instances as $instance) {
+ if ($instance->enrol === 'manual') {
+ $manualcache[$courseid] = $instance;
+ break;
+ }
+ }
+ }
}
}

0 comments on commit 4cb0242

Please sign in to comment.