Skip to content

Instantly share code, notes, and snippets.

@MrVibe
Created December 15, 2018 14:21
Show Gist options
  • Save MrVibe/31a3fa60e8c40c8f6507b5cf2b32f526 to your computer and use it in GitHub Desktop.
Save MrVibe/31a3fa60e8c40c8f6507b5cf2b32f526 to your computer and use it in GitHub Desktop.
WPLMS : Include all Quizzes connected to the course in Course evaluation irrespective whether they are included in the curriculum or not.
add_action('bp_get_course_check_course_complete',function($course_id,$user_id){
add_filter('bp_course_get_course_curriculum',function($curriculum,$course_id){
global $wpdb;
$quiz_ids = $wpdb->get_var($wpdb->prepare("SELECT post_id FROM {$wpdb->postmeta} WHERE meta_key ='vibe_quiz_course' AND meta_value = %d",$course_id));
if(!empty($quiz_ids)){
foreach($quiz_ids as $quiz_id){
if(array_search($quiz_id, $curriculum) === false){
$curriculum[]=$quiz_id;
}
}
}
return $curriculum;
},10,2);
},10,2);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment