diff --git a/user/index.php b/user/index.php
index 958cb055a5f..f36491cef55 100644
--- a/user/index.php
+++ b/user/index.php
@@ -225,8 +225,8 @@ echo $renderer->unified_filter($course, $context, $filtersapplied, $baseurl);
echo '
';
// Add filters to the baseurl after creating unified_filter to avoid losing them.
-foreach ($filtersapplied as $filter) {
- $baseurl->param('unified-filters[]', $filter);
+foreach (array_unique($filtersapplied) as $filterix => $filter) {
+ $baseurl->param('unified-filters[' . $filterix . ']', $filter);
}
$participanttable = new \core_user\participants_table($course->id, $groupid, $lastaccess, $roleid, $enrolid, $status,
$searchkeywords, $bulkoperations, $selectall);
diff --git a/user/tests/behat/filter_participants_showall.feature b/user/tests/behat/filter_participants_showall.feature
index 7f1ac9a04d4..6cec23e74d2 100644
--- a/user/tests/behat/filter_participants_showall.feature
+++ b/user/tests/behat/filter_participants_showall.feature
@@ -39,7 +39,7 @@ Feature: Course participants can be filtered to display all the users
And the following "course enrolments" exist:
| user | course | role | status | timeend |
| student1 | C1 | student | 0 | |
- | student2 | C1 | student | 1 | |
+ | student2 | C1 | student | 0 | |
| student3 | C1 | student | 0 | |
| student4 | C1 | student | 0 | |
| student5 | C1 | student | 0 | |
@@ -61,7 +61,7 @@ Feature: Course participants can be filtered to display all the users
| student21 | C1 | student | 0 | |
| student22 | C1 | student | 0 | |
| student23 | C1 | student | 0 | |
- | student24 | C1 | student | 0 | |
+ | student24 | C1 | student | 1 | |
| student1 | C2 | student | 0 | |
| student2 | C2 | student | 0 | |
| student3 | C2 | student | 0 | |
@@ -88,3 +88,20 @@ Feature: Course participants can be filtered to display all the users
Then I should see "Role: Student"
And I should see "Number of participants: 24" in the "//div[@class='userlist']" "xpath_element"
And I should see "Show 20 per page"
+
+ @javascript
+ Scenario: Apply more than one filter and show all users
+ Given I log in as "teacher1"
+ And I am on "Course 1" course homepage
+ And I navigate to course participants
+ When I open the autocomplete suggestions list
+ And I click on "Role: Student" item in the autocomplete list
+ And I open the autocomplete suggestions list
+ And I click on "Status: Active" item in the autocomplete list
+ And I click on "Show all 23" "link"
+ Then I should see "Role: Student"
+ And I should see "Status: Active"
+ And I should see "Number of participants: 23" in the "//div[@class='userlist']" "xpath_element"
+ And I should see "Student 1"
+ And I should not see "Student 24"
+ And I should see "Show 20 per page"