From bacb95612e70148ee0d8027ec4e8fd192fb3d3f5 Mon Sep 17 00:00:00 2001 From: Marina Glancy Date: Thu, 6 Nov 2014 18:37:32 +0800 Subject: [PATCH] MDL-48091 users: revert MDL-42875 Rvert of: "Show only profile visible roles on participants list" This reverts commit ecc8244e6296f9855924151cea69deeace05e421. --- user/index.php | 13 ++++--------- 1 file changed, 4 insertions(+), 9 deletions(-) diff --git a/user/index.php b/user/index.php index f35f757e7f7..e8875bd16b1 100644 --- a/user/index.php +++ b/user/index.php @@ -440,19 +440,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);