Ecommerce Shopify WordPress Discussion

Learndash – how do i force lessons and/or courses to complete via shortcode when all topics are done

Im having a bit of issue with learndash course autocomplete for some reason lessons are not being marked as completed anymore after all topics are finished. Im trying to achieve this function using bellow code add_action('learndash_topic_completed', 'custom_check_lesson_completion'); function custom_check_lesson_completion() { if (!empty($_POST)) { error_log('POST Data: ' . print_r($_POST, true)); } // Check if $_POST variable contains topic_id if (isset($_POST['post'])) { // Retrieve the topic ID $topic_id = intval($_POST['post']); // Get lesson ID associated with the completed topic $lesson_id = learndash_get_setting($topic_id, 'lesson'); // Check if the lesson is set if (!empty($lesson_id)) { // Get all topics associated with the lesson $lesson_topics = learndash_get_topic_list($lesson_id); // Check if all topics in the lesson are completed $all_completed = true; foreach ($lesson_topics as $lesson_topic) { if (!learndash_is_topic_complete(get_current_user_id(), $lesson_topic)) { $all_completed = false; break; } } // If all topics are completed, mark the lesson as completed if ($all_completed) { $this_lesson = get_post($lesson_id); // learndash_update_completion(get_current_user_id(), $lesson_id); learndash_mark_complete_process($this_lesson); } } } } i've tried multiple variations of the above code implementing different functions from this site https://developers.learndash.com/ But none of them seems to set the course progression to complete i've also tried just circumventing this by using the bellow code which just checks course progression and changes it if it is above a certain percent add_action( 'learndash_user_course_progress_updated', 'custom_mark_course_completed', 10, 5 ); function custom_mark_course_completed( $user_id, $course_id, $course_progress, $course_info, $ld_course ) { // Check if course progress is above 96% if ( $course_progress > 96 ) { // Set course progress to 100% learndash_update_user_course_progress( $user_id, $course_id, 100 ); // Mark course as completed learndash_mark_course_completed( $user_id, $course_id ); } }``` i believe my fault is possibly outdated learndash functions however i cant seem to find any info on that i would appreciate any help thanks
TurboCommerce make the better internet purchasing globaly

Turbo Multi-language Translator

Make the better internet purchasing globaly

Turbosify SEO Speed Booster

5.0 (7) Free plan available
Get better conversions by improving store loading speed Installed

Turbo Multi-language Chat - AI Customer service in one hand

TurboCommerce make the better internet purchasing globaly
Our products

The help you need, when you need it

App by Turbo Engine

3 apps • 5.0 average rating

Turbosify Speed Booster

5.0 (7)
Get better conversions by optimizing shopify store Google page speed Installed

Turbosify Translator for Wordpress Woocommerce

5.0 (74) Free Wordpress Woocommerce Plugin
Translate your wordpress website to multiple language within 1 click, no configuration needed, no No technical required

Grow your business here

Whether you want to sell products down the street or around the world, we have all the tools you need.