php - How can I mark a course as completed for a specific user in LearnDash? I want a function that will mark all lessons, topics, quizzes as complete

I found the "learndash_mark_complete" but it shows a button to complete. I want to complete it programatically for a few users in a few courses
Answer
Solution:
I believe you're looking for the learndash_process_mark_complete() function, which according to LearnDash "Updates the user meta with completion status for any resource."
It accepts the following arguments:
- $user_id - User ID. Default null.
- $postid - Optional. The ID of the resource like course, lesson, topic, etc.
- $onlycalculate - Optional. Whether to mark the resource as complete or just calculate it.
- $course_id - Optional. Course ID.
Share solution ↓
Additional Information:
Link To Answer People are also looking for solutions of the problem: filter_sanitize_string deprecated
Didn't find the answer?
Our community is visited by hundreds of web development professionals every day. Ask your question and get a quick answer for free.
Similar questions
Find the answer in similar questions on our website.
Write quick answer
Do you know the answer to this question? Write a quick response to it. With your help, we will make our community stronger.