From 419d1abdadce06bf37377fea8a3a8f2e94e7c49a Mon Sep 17 00:00:00 2001 From: Damyon Wiese Date: Fri, 7 Nov 2014 09:30:42 +0800 Subject: [PATCH] MDL-48091 users: Revert "MDL-42875 users: Show only profile visible..." This reverts commit a09a837f20e2e09a19c8120bf71bac794ee68ae6. --- user/index.php | 13 ++++--------- 1 file changed, 4 insertions(+), 9 deletions(-) diff --git a/user/index.php b/user/index.php index df610d9a50a..c1adf8904b0 100644 --- a/user/index.php +++ b/user/index.php @@ -438,19 +438,14 @@ $params['contextlevel'] = CONTEXT_USER; $select .= $ccselect; $joins[] = $ccjoin; -// We want to query both the current context and parent contexts. -list($relatedctxsql, $relatedctxparams) = $DB->get_in_or_equal($context->get_parent_context_ids(true), SQL_PARAMS_NAMED, 'relatedctx'); -$params = array_merge($params, $relatedctxparams); // Limit list to users with some role only. if ($roleid) { + // We want to query both the current context and parent contexts. + list($relatedctxsql, $relatedctxparams) = $DB->get_in_or_equal($context->get_parent_context_ids(true), SQL_PARAMS_NAMED, 'relatedctx'); + $wheres[] = "u.id IN (SELECT userid FROM {role_assignments} WHERE roleid = :roleid AND contextid $relatedctxsql)"; - $params = array_merge($params, array('roleid' => $roleid)); -} else { - $profileroles = explode(',', $CFG->profileroles); - list($insql, $inparams) = $DB->get_in_or_equal($profileroles, SQL_PARAMS_NAMED); - $wheres[] = "u.id IN (SELECT userid FROM {role_assignments} WHERE roleid $insql AND contextid $relatedctxsql)"; - $params = array_merge($params, $inparams); + $params = array_merge($params, array('roleid' => $roleid), $relatedctxparams); } $from = implode("\n", $joins);