I am looking for a way to unlock a LearnDash course based on the user's results from all quizzes in a prerequisite course.
I have bought the LearnDash Adaptive Learning Pro plugin supposed to do the job, but it is not working with the latest version of LearnDash 3.2.3.5 and I am near the deadline of my project.
So I started to look how to create a custom function that can get users overall score and enroll him into the next course which is set to Closed.
I found an old thread auto-enrolling WP Roles in a Learndash course that was not working but managed to fix by just replacing $users with $blogusers.
// Enrolling user role into courses
$blogusers = get_users( [ 'role__in' => [ 'subscriber'] ] );
foreach ( $blogusers as $user ) {
ld_update_course_access( $user->ID, 5883, false );
ld_update_course_access( $user->ID, 7521, false );
ld_update_course_access( $user->ID, 6108, false );
}
Now, I need a function that gets the user's "cumulative score" for a course (which is average for all quizzes in a course) and compare if it's greater than "70" for e.g to enroll the users into other courses.
Is it possible?
Thanks
Finally, I managed to figure this thing out for now. It's a bit lame with the shortcode but is working perfect for me. I am posting the solution here for anyone that is searching the internet for similar case.