Set LearnDash lessons to completed Storyline triggers


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.


11 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.