Permalink
Browse files

Merge branch 'wip-MDL-31072-MOODLE_22_STABLE' of github.com:marinagla…

…ncy/moodle into MOODLE_22_STABLE
  • Loading branch information...
2 parents 6a22683 + ee5cf90 commit 94828bec3588291eee96d6b9c69e1da807161382 @nebgor nebgor committed Jan 16, 2012
Showing with 9 additions and 11 deletions.
  1. +4 −6 admin/roles/lib.php
  2. +5 −5 user/selector/lib.php
View
@@ -1044,10 +1044,9 @@ public function find_users($search) {
$sql = " FROM {user} u
WHERE u.id IN ($enrolsql) $wherecondition
AND u.id NOT IN (
- SELECT u.id
- FROM {role_assignments} r, {user} u
+ SELECT r.userid
+ FROM {role_assignments} r
WHERE r.contextid = :contextid
- AND u.id = r.userid
AND r.roleid = :roleid)";
$order = ' ORDER BY lastname ASC, firstname ASC';
@@ -1096,10 +1095,9 @@ public function find_users($search) {
$sql = " FROM {user}
WHERE $wherecondition
AND id NOT IN (
- SELECT u.id
- FROM {role_assignments} r, {user} u
+ SELECT r.userid
+ FROM {role_assignments} r
WHERE r.contextid = :contextid
- AND u.id = r.userid
AND r.roleid = :roleid)";
$order = ' ORDER BY lastname ASC, firstname ASC';
View
@@ -369,13 +369,13 @@ protected function load_selected_users() {
// See if we got anything.
if ($this->multiselect) {
$userids = optional_param_array($this->name, array(), PARAM_INTEGER);
- } else {
- $userid = optional_param($this->name, 0, PARAM_INTEGER);
- if (empty($userid)) {
- return array();
- }
+ } else if ($userid = optional_param($this->name, 0, PARAM_INTEGER)) {
$userids = array($userid);
}
+ // If there are no users there is nobody to load
+ if (empty($userids)) {
+ return array();
+ }
// If we did, use the find_users method to validate the ids.
$this->validatinguserids = $userids;

0 comments on commit 94828be

Please sign in to comment.