Set LearnDash lessons to completed Storyline triggers

Aug 28, 2018


In a recent project. I used LearnDash as LMS with the Uncanny plugin for reporting. There was no quiz in the tincan modules and the customer didn't want the user to use the 'mark as complete' button in LearnDash. 

I found this article online to set Captivate and iSpring courses to completed in LearnDash:

I adjusted the code so that it also works with triggers in Articulate Storyline.

What i've done. I created an 'Execute Javascript' trigger on the last slide of the module when the timeline started. With the following piece of code:

function module_completed() {
// this is for learndash
let np = parent.document.getElementById("sfwd-mark-complete")
if (np != null) {


What this piece of code does is it 'clicks' the LearnDash 'mark as complete' button so LearnDash sets the Lesson to completed.  

To prevent issues we have hidden the button with a piece of php code. That goes into the functions.php of the WordPress theme that you are using.

function hide_mark_complete_button(){
global $post;
$tags = wp_get_post_tags( $post->ID );
$tag_found = false;
foreach ($tags as $tag) {
if ($tag->name == 'hide_complete') { $tag_found = true;};
if( $tag_found == true ) {
#llms_mark_complete {

This piece of code hides the 'mark as completed' buttons in LearnDash on al lesson pages with the WordPress tag 'hide_complete'. 

The 'mark as completed' button is hidden for users, but is still accessible from the Storyline Course.

I hope this can help other Storyline users that are working with LearnDash and Storyline.


14 Replies
Lynette Kramer

I'm using the JavaScript provided in this post and have one issue. When I complete the lesson, the script closes the course (which I have in a lightbox) but the course is not marked complete. I tried refreshing and received the attached Confirm Form Resubmission message. I continued but the lesson was still not marked complete. I launch the lesson again (I have it prompt to resume or restart) and resume. The lesson opens, the script runs again, closes the lesson and now it is marked complete. Not the best user experience. Any ideas? I'm authoring in SL360.

Lynette Kramer

Hi Carrie Ann,

I fortunately have someone working with me who is a great researcher. He found this plugin for me:

When I saw it I realized I had used it before several years ago when I set up a LearnDash LMS just to practice with and see what it could do. That plugin worked great then and works great now. One thing you need to know is you have to have your SCORM package at the Topic level. So after you create your Course and Lesson, create your Topic. These are the steps I follow:

Create Course

·         Add description

·         Uncheck Allow Comments box

·         Course Price Type: Free

·         Is there a certificate?

·         Set featured image

Create Lesson

·         Add description: Select the XXX Training link below.

·         Uncheck Allow Comments box

·         Auto Complete: Enabled

·         Select Associated Course

Create Topic

·         Uncheck Allow Comments box

·         Hide the “Mark Complete” button

·         Select the Open button to launch the training program.

·         Upload SCORM package with parent.submitLearnDashTopicComplete();

·         Auto Complete: Disabled

·         Select Associated Course

·         Select Associated Lesson

·         Restrict Mark Complete: Yes

·         Completion Condition: result > 75

Hope that helps!

Saurabh Chauhan

Hii Neil,

If you also want to implement the same thing, you can use GrassBlade xAPI Companion plugin, it won't require adding javascript in every xAPI Content and it works like a charm.

  1. You will be able to add xAPI Content using Gutenberg Blocks (1 click upload).
  2. Your Mark Complete button will be hidden.
  3. Lesson/Topic/Quiz will be marked completed.
  4. You can pass the xAPI Content Quiz score in LearnDash Certificate.
  5. The best thing is UI/UX, the content will be super responsive.

Also, there are many more benefits.

Thanks for your time, have nice day.

This discussion is closed. You can start a new discussion or contact Articulate Support.