Last active
September 24, 2015 12:15
-
-
Save MrVibe/cd67c4965dc1caf8e87a to your computer and use it in GitHub Desktop.
Enable/Disable Certificate & Badge on Course assignment by checking Student's Membership level
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
add_filter('wplms_course_student_certificate_check','check_user_membership_level',10,5); // Remove this if not required for Certificates | |
add_filter('wplms_course_student_badge_check','check_user_membership_level',10,5); // Remove this if not required for Badges | |
function check_user_membership_level($flag,$course_id,$user_id,$student_score,$awadrding_score){ | |
$membership_ids = array(3); // You need to know the Membership ID or ID's (array(3,4)) in which you want to award certificate/badge to user | |
// Assuming 3 is the membership ID of the user in which we can award certificates/badges to the user | |
if(function_exists('pmpro_hasMembershipLevel') && pmpro_hasMembershipLevel($membership_ids,$user_id)){ | |
return 1; // Continue with Certificate awarding process | |
}else{ | |
return 0; // Disable Certificate awarding process | |
} | |
return $flag; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment