Set LearnDash lessons to completed Storyline triggers

Hi,

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: https://medium.com/@hdecisions/learndash-completion-tracking-for-xapi-content-from-captivate-ispring-etc-a0848a32754d

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) {
np.submit();
return;
}
}

module_completed();

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.

add_action('wp_head','hide_mark_complete_button');
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 ) {
?>
<style>
#sfwd-mark-complete{
display:none;
}
#llms_mark_complete {
display:none;
}
</style>
<?php
};
};

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.

Regards,
Mark

13 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: https://www.discoverelearninguk.com/store/learndash-topic-progression-using-storyline-captivate/

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!