We have now added two filters for this : wplms_finish_course_check and wplms_unfinished_unit_quiz_message

NOTE : This tip is no longer required for WPLMS versions 1.9.4 as it is inbuilt in WP Admin - LMS - Settings section

1. Add following code in WP Admin -> Plugins -> Editor -> WPLMS Customizer -> wplms-customizer.php
or

Add this code in child theme->functions.php

 

add_action('init','wplms_custom_hooks');
function wplms_custom_hooks(){
add_filter('wplms_finish_course_check','custom_wplms_finish_course_check',10,2);
add_filter('wplms_unfinished_unit_quiz_message','custom_wplms_unfinished_unit_quiz_message',10,2);  
}
        // ADD custom Code in class
function custom_wplms_finish_course_check($flag,$course_curriculum){
 
if(isset($course_curriculum) && count($course_curriculum)){
  $user_id = get_current_user_id();
        foreach($course_curriculum as $id){
            if(is_numeric($id) && get_post_type($id) == 'quiz'){
                $marks=get_post_meta($id,$user_id,true);
               $passing_score = get_post_meta($id,'quiz_passing_score',true);
                if(isset($marks) && is_numeric($marks) && isset($passing_score) && is_numeric($passing_score) && $marks < $passing_score){
                    return $id;
                }
            }
        }
    }
return $flag;
}
 
function custom_wplms_unfinished_unit_quiz_message($message,$quiz_id){
if(get_post_type($quiz_id) == 'quiz'){
$user_id = get_current_user_id();
              $marks=get_post_meta($quiz_id,$user_id,true);
               $passing_score = get_post_meta($quiz_id,'quiz_passing_score',true);
              if(isset($marks) && is_numeric($marks) && isset($passing_score) && is_numeric($passing_score) && $marks < $passing_score){
    $message = 'You need to get marks more than '.$passing_score.' in quiz to finish the course, please retake the quiz :'.get_the_title($quiz_id);
              }
}
return $message;
}

 

You need to add a Custom field in quiz for each quiz you want to enable this feature, which is used in above code, quiz_passing_score