-
Notifications
You must be signed in to change notification settings - Fork 134
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Bulk Enrollment for Courses & Memberships #562
Comments
Looks like the last 2 are not possible in the way I assumed they would be. However, I was able to find workarounds and am still able to run the bulk enrollment. Will be able to push this in a day or so. |
Finished all the code for bulk enrollment here: https://github.com/actual-saurabh/lifterlms/blob/feature/bulk-enroll/includes/admin/class.llms.student.bulk.enroll.php Added select2 extension here: https://github.com/actual-saurabh/lifterlms/blob/feature/bulk-enroll/assets/js/llms-bulk-enroll.js Wasn't able to test thoroughly but the js doesn't seem to load at all. Will test and fine tune before sending in a PR |
Not sure why JS isn't getting enqueued at all. Will look at it afresh tomorrow. |
A side thought, similar functionality can be added to the Edit User screen to bulk enroll one user into many courses/memberships with a few tweaks. |
@actual-saurabh I'm wondering if it would be better to group the notices into a single notice with a Just a thought |
@thomasplevy I did think about this. I considered 3 scenarios:
Most common use cases, afaik, would be 1 & 2. If someone does perform 3, that'll be a one off, very rare user experience. I felt that since each enrollment is a separate operation, it makes sense to keep the notice separate to distinguish the state (success, error) in line with WordPress's default functionality. I'm banking on WordPress core taking care of grouping notifications in the near future. See: https://core.trac.wordpress.org/ticket/43484 In any case, simply refreshing the page or navigating away from the screen would clear all the notifications by default. So, I decided to keep it as it is, even if it is unelegant, for the sake of consistency with WP's admin experience. In that vein, I feel it is more consistent with the idea of being able to clear the success notices and have only the failed notifications on screen, if and when enrollment fails for some users. |
Using
manage_users_extra_tablenav
action here: https://github.com/WordPress/WordPress/blob/master/wp-admin/includes/class-wp-users-list-table.php#L300, it'd be easy to add aselect2
box for memberships and courses and have a simple UI for bulk enrollment. The choice would be limited to only one course or membership at a time.Set a custom administrative action called
'enroll'
(https://github.com/WordPress/WordPress/blob/master/wp-admin/includes/class-wp-list-table.php#L478-L499 & https://github.com/WordPress/WordPress/blob/master/wp-admin/users.php#L99Filter the
default
case of the switch statement here: https://github.com/WordPress/WordPress/blob/master/wp-admin/users.php#L444 to get the array ofuser_ids
and the rest of the$_POST
data and then loop through each user and runllms_enroll_student
https://github.com/gocodebox/lifterlms/blob/master/includes/functions/llms.functions.person.php#L156-L171 to complete enrollmentThe text was updated successfully, but these errors were encountered: