Set LearnDash lessons to completed Storyline triggers
Aug 28, 2018
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
14 Replies
Awsome Mark. Thanks so much for sharing this. The mark as complete button in LearnDash is a strange thing so it is great that you have found a workaround.
Hi,
If you use Grasblade LRS there is no need for this when using completion tracking. It is enabled through the LRS.
Another solution may be If no LRS you can use this plugin https://learning-templates.com/product/learndash-mark-complete-shortcode/
Cheers
Hi Mark,
You may have also found our plugin helpful, it pretty much does the same thing!
Chris
https://en-gb.wordpress.org/plugins/learndash-topic-progression-using-storyline-or-captivate/
Hi Chris. Thanks for mentioning the plugin. I found it online. But it only handles completion for topics right? And not for lessons
Thanks for extending this solution to Storyline!
-- healthdecisions
Thanks Mark. very helpful.
True, Learndash-topic progression plug-in works only for topics. True, Mark-complete short cut hide the mark complete button but does not it 'clicks' the LearnDash 'mark as complete' button so LearnDash sets the Lesson to completed.
Hi Mark. I'm testing this now for a course we're working on. Does this only work when you have the Storyline course embedded in the WordPress page, or does it still work when you have it launch in a new window?
Hi Brian. Only when you have the Storyline course embedded in the WordPress page. Due to security restrictions you cannot change the content from one page by clicking on another page. For instance your pop-up. Hope this helps!
If you have any questions let me know!
Mark
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.
I face exactly the same issue. Did you find a solution. Thank you,
Christophe
Hi Lynette,
My client is having the exact same issue. Did you find a workaround?
Carrie Ann
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!
Hi Mark,
Could I just check that you've got the Storyline file embedded in an iframe? I can't seem to get the code to work!
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.
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.