gocodebox / lifterlms

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

Invalid memberships when using the Restrict this page functionality #2727

Open brianhogg opened 1 month ago

brianhogg commented 1 month ago

Reproduction Steps

  1. Create one or more memberships
  2. Create a new page or edit an existing page
  3. Turn on "Restrict this page" in the menu on the right
  4. Select one or more memberships in the select box
  5. Use the black "X" to remove memberships
  6. Save
  7. Select one membership
  8. Save again
  9. Refresh the page

Expected Behavior

Only the one membership is shown

Actual Behavior

Sometimes "None" shows as an option which then turns into " (ID#)" in the listing as a "phantom" membership. This can cause problems with restricting the access or showing an appropriate message when someone tries to access it who doesn't have access.

https://github.com/user-attachments/assets/8a31a0e1-aaec-433f-90b3-83f6d7fef4ab

Tech Notes

It looks like these entries are saved as "" (empty string) in the array of restricted IDs.

This issue has be recreated: