Limit number of memberships shown in student dashboard - #3272
Open
faisalahammad wants to merge 1 commit into
Open
Limit number of memberships shown in student dashboard#3272faisalahammad wants to merge 1 commit into
faisalahammad wants to merge 1 commit into
Conversation
The My Memberships tab listed every membership a student belongs to with no cap. Added a filterable limit (default 500) so large lists stop rendering unbounded output, matching how the My Courses loop already works. Fixes gocodebox#2442
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
The My Memberships tab (
/my-account/my-memberships/) lists every membership a student belongs to with no cap and no pagination.lifterlms_template_my_memberships_loop()now caps the list at 500 by default. The limit can be changed with a new filter:This mirrors the existing pattern in
lifterlms_template_my_courses_loop(), which already caps its list at 500 the same way.Fixes #2442
How has this been tested?
Added PHPUnit coverage in
tests/phpunit/unit-tests/functions/class-llms-test-functions-templates-dasbhoard.php:0filter value disables the cap entirely.Ran
composer tests -- --filter LLMS_Test_Functions_Templates_Dashboard(11/11 passing) andcomposer check-cs(clean).Manually tested on a local install: enrolled a test student in several memberships, confirmed the dashboard tab renders all of them normally, then lowered the filter to 1 and confirmed only 1 membership rendered, then set it to 0 and confirmed all memberships rendered again.
Checklist: