Skip to content

Students: add status filter and summary section to accounts screen - #281

Merged
maciejpilarski merged 1 commit into
WordPress:trunkfrom
wppoland:filter-student-status
Oct 28, 2026
Merged

maciejpilarski merged 1 commit into
WordPress:trunkfrom
wppoland:filter-student-status

Conversation

@wppoland

Copy link
Copy Markdown
Contributor

Summary

This PR resolves #260 by adding a student status filter dropdown and a summary section with student counts per status to the Students admin dashboard (admin.php?page=wpcpm-students on the Accounts tab).

Details

  • Status Filter:
    • Adds a <select name="wpcpm_status" id="wpcpm-status"> dropdown to extra_tablenav( 'top' ) alongside the institution dropdown.
    • Dropdown options display human-readable status labels (via WPCPM_Program::status_words()) and student counts.
    • Retains and combines seamlessly with the existing institution filter (wpcpm_institution), search clause (s), views, sorting, and pagination.
    • When either status or institution filter is active, the "Show all students" link clears both filters back to the full list.
  • Summary Section:
    • Implements list_intro() in WPCPM_Students_Table to display a summary bar (.wpcpm-students-summary) above the list views with chip links (.wpcpm-waiting) showing each status, its count, and linking directly to #wpcpm-accounts-list with that status filtered.
  • State and Scope:
    • Updates WPCPM_Students::list_state() and adds WPCPM_Students::status_filter().
    • In WPCPM_Students_Table, stores status in the in-memory roster (reading from wpcpm_student_program once, with zero extra DB queries).
    • Scope method filters student account IDs by status matching.
  • Tests:
    • Extended bin/test-students-screen.php with status_picker(), verifying status dropdown options, summary chips, status filtering, and combined status + institution filtering.
    • Full test suite passes cleanly (ALL PASS (163 checks)).

Fixes #260.

Add status filter dropdown and a summary section with counts per status to the Students accounts table (admin.php?page=wpcpm-students), supporting combined filtering with institution and search. Fixes WordPress#260.
@maciejpilarski

Copy link
Copy Markdown
Contributor

Thanks @wppoland, this covers both halves of #260, the filter and the summary per status, and it applies cleanly to the current code. Notes before we bring it in:

  1. Naming: the value it filters is the one the table's Program column shows (the sync stores the Airtable Status in the program row's program). When we port it, that column becomes Status too, so the screen uses one word, and the column will show the same plain words as your picker (status_words()) rather than the raw Airtable value.
  2. Order: ksort() sorts by the stored values, while the options and chips show the status_words() labels, so "In Sensei" lands among the I's but reads "WordPress Credits Program 150h". The program's own order, the current statuses and then the past ones from Settings, would read better.
  3. The current chip's look is an inline style. A .wpcpm-waiting a.current rule in assets/css/admin.css, with aria-current="true" on the link, keeps it beside the chips' other rules and tells screen readers which one is in force.

As with #280, the mirror is overwritten by each release push, so please don't merge here: we'll port it with your authorship into the next release and close this PR when it reaches trunk.

@maciejpilarski

Copy link
Copy Markdown
Contributor

Thank you @wppoland! This is now in the plugin as release 1.123.43, live on wordpresseducation.org since 28 October. Your commit is kept under your name in the plugin's source repository; here on the mirror the release arrives as one commit, 5463559.

On top of your change, as noted above:

  • the column is called Status, and the column, the picker and the summary show the same words, in the program's order of statuses;
  • each picker and the summary count within the other filter chosen, the chosen status stays offered at 0, and a chip keeps the view;
  • the chip in force has aria-current, with its look in admin.css;
  • the Invitations card counts and invites within the status as well as the institution;
  • the query argument is now wpcpm_student_status, because the mail layer strips wpcpm_status from return addresses.

The Students section of the Administrator guide describes it.

Closing this in favor of that release. Thanks again!

maciejpilarski added a commit that referenced this pull request Oct 28, 2026
The Email Log's links to the Accounts screens (#280) and the Students
screen's status filter and summary (#281) are wppoland's work. They
reached this repository inside the release commit 5463559, which was
pushed without a co-author line; this commit records the credit.

Co-authored-by: wppoland <19728801+wppoland@users.noreply.github.com>
@maciejpilarski
maciejpilarski merged commit c07788d into WordPress:trunk Oct 28, 2026
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Idea]: Add a filter for student status on the admin dashboard

2 participants