gocodebox / lifterlms

LifterLMS, a WordPress LMS Solution: Easily create, sell, and protect engaging online courses.
https://lifterlms.com
GNU General Public License v3.0
181 stars 135 forks source link

Deleted memberships cause a page restricted by that membership to potentially be inaccessible #2725

Closed brianhogg closed 2 months ago

brianhogg commented 2 months ago

Reproduction Steps

  1. Create two memberships
  2. Enrol a student in both memberships
  3. Create a page, enable Restrict this page, and selected the two created memberships
  4. Move the first membership to the trash and delete it permanently
  5. Login as the student and visit the page

Expected Behavior

I believe the page should be visible since the student is still in the second membership.

Actual Behavior

Page is not accessible with an error saying "You must belong to one of the following memberships to access this content: or A second membership"

Captura de pantalla 2024-08-13 a las 9 58 37 a  m

Technical Notes

I think in llms_is_post_restricted_by_membership() we want to exclude checking for enrolments in memberships that aren't valid.

This issue has be recreated:

brianhogg commented 2 months ago

This is now fixed. The multi-membership listing was reverted, and deleted memberships no longer prevent access from my testing.