Merge branch 'MDL-40666-master' of git://github.com/danpoltawski/moodle
authorSam Hemelryk <sam@moodle.com>
Tue, 23 Jul 2013 02:09:08 +0000 (14:09 +1200)
committerSam Hemelryk <sam@moodle.com>
Tue, 23 Jul 2013 02:09:08 +0000 (14:09 +1200)
1  2 
enrol/externallib.php

diff --combined enrol/externallib.php
@@@ -197,7 -197,7 +197,7 @@@ class core_enrol_external extends exter
                      'users' => new external_multiple_structure(
                          new external_single_structure(
                  array(
-                     'id'    => new external_value(PARAM_NUMBER, 'ID of the user'),
+                     'id'    => new external_value(PARAM_INT, 'ID of the user'),
                      'username'    => new external_value(PARAM_RAW, 'Username', VALUE_OPTIONAL),
                      'firstname'   => new external_value(PARAM_NOTAGS, 'The first name(s) of the user', VALUE_OPTIONAL),
                      'lastname'    => new external_value(PARAM_NOTAGS, 'The family name of the user', VALUE_OPTIONAL),
          }
  
          list($enrolledsql, $enrolledparams) = get_enrolled_sql($coursecontext, $withcapability, $groupid, $onlyactive);
 -        list($ctxselect, $ctxjoin) = context_instance_preload_sql('u.id', CONTEXT_USER, 'ctx');
 -        $sqlparams['courseid'] = $courseid;
 +        $ctxselect = ', ' . context_helper::get_preload_record_columns_sql('ctx');
 +        $ctxjoin = "LEFT JOIN {context} ctx ON (ctx.instanceid = u.id AND ctx.contextlevel = :contextlevel)";
 +        $enrolledparams['contextlevel'] = CONTEXT_USER;
          $sql = "SELECT u.* $ctxselect
                    FROM {user} u $ctxjoin
                   WHERE u.id IN ($enrolledsql)