mirror of
https://github.com/moodle/moodle.git
synced 2025-08-06 01:16:44 +02:00
MDL-40468 libraries: removed usages of get_related_contexts_string() in core
Also tidied up the functions by removing unused parameters.
This commit is contained in:
parent
b645284403
commit
4e829d48d1
10 changed files with 96 additions and 104 deletions
|
@ -177,14 +177,17 @@ function search_users($courseid, $groupid, $searchtext, $sort='', array $excepti
|
|||
|
||||
} else {
|
||||
$context = context_course::instance($courseid);
|
||||
$contextlists = get_related_contexts_string($context);
|
||||
|
||||
// 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');
|
||||
|
||||
$sql = "SELECT u.id, u.firstname, u.lastname, u.email
|
||||
FROM {user} u
|
||||
JOIN {role_assignments} ra ON ra.userid = u.id
|
||||
WHERE $select AND ra.contextid $contextlists
|
||||
WHERE $select AND ra.contextid $relatedctxsql
|
||||
$except
|
||||
$order";
|
||||
$params = array_merge($params, $relatedctxparams);
|
||||
return $DB->get_records_sql($sql, $params);
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue