diff --git a/admin/tool/cohortroles/classes/output/cohort_role_assignments_table.php b/admin/tool/cohortroles/classes/output/cohort_role_assignments_table.php index 496a4acca3d..01fa4d52e6e 100644 --- a/admin/tool/cohortroles/classes/output/cohort_role_assignments_table.php +++ b/admin/tool/cohortroles/classes/output/cohort_role_assignments_table.php @@ -189,7 +189,12 @@ class cohort_role_assignments_table extends table_sql { FROM {tool_cohortroles} uca JOIN {user} u ON u.id = uca.userid JOIN {cohort} c ON c.id = uca.cohortid"; - $params = array(); + + // Check if any additional filtering is required. + [$sqlwhere, $params] = $this->get_sql_where(); + if ($sqlwhere) { + $sql .= " WHERE {$sqlwhere}"; + } // Add order by if needed. if (!$count && $sqlsort = $this->get_sql_sort()) { diff --git a/admin/tool/cohortroles/index.php b/admin/tool/cohortroles/index.php index cc9947cc70d..3396ddb20cf 100644 --- a/admin/tool/cohortroles/index.php +++ b/admin/tool/cohortroles/index.php @@ -86,8 +86,8 @@ if ($removeid) { $title = get_string('existingcohortroles', 'tool_cohortroles'); echo $output->heading($title); - $url = new moodle_url('/admin/tool/cohortroles/index.php'); - $table = new tool_cohortroles\output\cohort_role_assignments_table(uniqid(), $url); + + $table = new tool_cohortroles\output\cohort_role_assignments_table('cohort-role-assignments', $pageurl); echo $table->out(50, true); echo $output->spacer();