Skip to content

Instantly share code, notes, and snippets.

@MrVibe
Last active May 6, 2020 04:31
Show Gist options
  • Save MrVibe/d2ee359cef0b0f4b607015af5fdf7a46 to your computer and use it in GitHub Desktop.
Save MrVibe/d2ee359cef0b0f4b607015af5fdf7a46 to your computer and use it in GitHub Desktop.
Disable course retakes once the user passes the course and gets course certificate
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);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment