Skip to content

Commit

Permalink
Merge branch 'MDL-73898-311' of https://github.com/paulholden/moodle
Browse files Browse the repository at this point in the history
…into MOODLE_311_STABLE
  • Loading branch information
andrewnicols committed Jun 3, 2022
2 parents 2fe2cd8 + 93315ab commit fc056f1
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions user/classes/table/participants_search.php
Expand Up @@ -156,6 +156,8 @@ public function get_total_participants_count(string $additionalwhere = '', array
* @return array
*/
protected function get_participants_sql(string $additionalwhere, array $additionalparams): array {
global $CFG;

$isfrontpage = ($this->course->id == SITEID);
$accesssince = 0;
// Whether to match on users who HAVE accessed since the given time (ie false is 'inactive for more than x').
Expand All @@ -169,7 +171,8 @@ protected function get_participants_sql(string $additionalwhere, array $addition
// Note: This ensures the outer (filtering) query joins on distinct users, avoiding the need for GROUP BY.
$innerselect = "SELECT DISTINCT {$inneruseralias}.id";
$innerjoins = ["{user} {$inneruseralias}"];
$innerwhere = "WHERE {$inneruseralias}.deleted = 0";
$innerwhere = "WHERE {$inneruseralias}.deleted = 0 AND {$inneruseralias}.id <> :siteguest";
$params = ['siteguest' => $CFG->siteguest];

$outerjoins = ["JOIN {user} u ON u.id = {$usersubqueryalias}.id"];
$wheres = [];
Expand All @@ -189,8 +192,9 @@ protected function get_participants_sql(string $additionalwhere, array $addition
'sql' => $esql,
// SQL for enrolment filtering that must always be applied (eg due to capability restrictions).
'forcedsql' => $esqlforced,
'params' => $params,
'params' => $eparams,
] = $this->get_enrolled_sql();
$params = array_merge($params, $eparams);

// Get the fields for all contexts because there is a special case later where it allows
// matches of fields you can't access if they are on your own account.
Expand Down

0 comments on commit fc056f1

Please sign in to comment.