Skip to content

Batch processing for retroactively enrolling members to courses.#108

Open
andrewlimaza wants to merge 2 commits intostrangerstudios:devfrom
andrewlimaza:retroactive-enrollment-for-modules
Open

Batch processing for retroactively enrolling members to courses.#108
andrewlimaza wants to merge 2 commits intostrangerstudios:devfrom
andrewlimaza:retroactive-enrollment-for-modules

Conversation

@andrewlimaza
Copy link
Copy Markdown
Contributor

  • ENHANCEMENT: Retroactively enroll members that may be missing from courses, by existing before a new course is added. This now automatically enrolls members in batches, and requires PMPro 3.5+

This won't re-run batches whenever a member is added to a level programmatically and bypasses any WordPress hooks. This needs a bit more thought, but I am adding this PR for the time being. This is definitely a starting point, and something to think about - a workaround would be to delete post meta "_pmpro_courses_batch_enrollment_levels" for the post types and rerun the scheduled actions (which I think is good enough).

Resolves #72.

How to test the changes in this Pull Request:

  1. Before pulling this PR into your local development environment, make sure you have members.
  2. Create a bunch of courses inside a module that has enrollment feature (LifterLMS, Learndash etc) and require the relevant membership levels. Just do "All".
  3. See that no members are given enrollment to these courses.
  4. Pull this PR into your local development environment.
  5. Manually run the pmpro_schedule_daily action to invoke it OR go to a pre-existing course and save the post. The scheduled action should then asynchronously be added to Action Scheduler to enroll the members to the course.
  6. This logic runs on 2 actions: Once a day and whenever you save a post for the first time (since this PR/Update).

Tested with Learndash, other modules are untested but logic looks correct and to be tested before next release.

* FEATURE: Added support for batch enrollment for course integrations that use "enrollment".
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Include ability to add a new course to existing members

1 participant