lifterlms
lifterlms copied to clipboard
The Access Plan Button Settings > Access Plan of the Access Plan Button Block can only display a maximum of 10 plans,
Reproduction Steps
- Start with a fresh installation of WordPress and LifterLMS, with no course imports.
- Create two new courses in
WordPress Dashboard > Courses. - Create
6access plans for each course. - Create a third course.
- Drag and drop the
Access Plan Buttonblock in the content area of the third course. - Under
Access Plan Button Settings > Access Plan, you'll notice that only10access plans are listed.
Expected Behavior
All 12 access plans must show up.
Actual Behavior
Not all 12 access plans showed up. Only 10 did.
This issue has been recreated:
- [x] Locally
- [ ] On a staging site
- [x] On a production website
- [x] With only LifterLMS and a default theme
I believe this limitation of the access plan count maximum was a performance consideration. I believe there may already be a workaround (filter or hook / gist) if someone wants to override the limit and take the performance hit. I'm ok with increasing the maximum if engineering sees it as not a significant performance tradeoff.
The problem is that the number of access plans that are going to populate the select is fetched via the rest api, which, by default, returns the first 10 items. https://github.com/gocodebox/lifterlms/blob/185e02878c7395e795b3763a501f645ea39bc8d7/src/blocks/access-plan-button/index.jsx#L38
This problem seems to affect all the new blocks that are using selects with data fetched via rest api.
We can fetch the last 100 items, but that would be a workaround. Maybe enough for now.
The best would be, though, using a search box like the one we use in the Enrollment Visibility option: