Disable Course Retake once the user passed the Course and achieved the certificate

Copy and Paste in Customizer. Once the student passes the course by getting more marks set in the course – certificate percentage , the retake button is disabled.

add_filter('wplms_course_retake_count',function($count,$course_id,$user_id){
$status = bp_course_get_user_course_status($user_id,$course_id);
if($status == 4){
$marks = bp_course_get_marks($user_id,$course_id);
$passing_per = get_post_meta($id,'vibe_course_passing_percentage',true);
if($marks > $passing_per){
return 0;
}
}
return $count;
},999,3);

Leave a Reply

Your email address will not be published. Required fields are marked *