gocodebox / lifterlms

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

[Dev] Using llmsPostsSelect2 on a group of elements is not reliable #2805

Open brianhogg opened 1 week ago

brianhogg commented 1 week ago

Reproduction Steps

  1. Add multiple select boxes with the llms-posts-select2 class
  2. Add data-post-type on the second one (ie. llms-group)

Expected Behavior

The second dropdown works as expected, fetching posts from the specified post type

Actual Behavior

It uses the post type from the first dropdown since options is shared and llmsSelect2 is initialized on all the dropdowns at the same time.

Testing

Testing a fix for this will just be making sure dropdowns like the bulk enroll "Select Course/Membership" on the Users page, filters on LifterLMS > Reporting, "Enrollments" tab, etc still work as expected.

This issue has be recreated:

Browser, Device, and Operating System Information