Custom certifcate codes and verification

1. Use the Filter : wplms_certificate_code to encrypt the certificate code. For example , add following code in the functions.php file in your child theme.

PHP Code:
add_filter('wplms_certificate_code','my_custom_certificate_code',10,3);
function my_custom_certificate_code($code,$course_id,$user_id){
 
// Create a custom Certificate Code using the 3 input variables.
 
return $code;
}

2. Use the filters to decode the code and get the certificate template id, user id and course id of the certificate, code to be added in functions.php :

PHP Code:
//Remove Certificate validating codes
remove_filter('wplms_certificate_code_template_id','wplms_get_template_id_from_certificate_code');
remove_filter('wplms_certificate_code_user_id','wplms_get_user_id_from_certificate_code');
remove_filter('wplms_certificate_code_course_id','wplms_get_course_id_from_certificate_code');
//Add your custom codes
add_filter('wplms_certificate_code_template_id','mywplms_get_template_id_from_certificate_code');
add_filter('wplms_certificate_code_user_id','mywplms_get_user_id_from_certificate_code');
add_filter('wplms_certificate_code_course_id','mywplms_get_course_id_from_certificate_code');
 
function mywplms_get_template_id_from_certificate_code($code){
  //get certificate template id from code
/* grab $course_id from $code
$template = get_post_meta($course_id,'vibe_certificate_template',true);
*/
  return $template;
}
 
function mywplms_get_user_id_from_certificate_code($code){
   //get user id from code
    return $user_id;
}
 
function mywplms_get_course_id_from_certificate_code($code){
   //get course id from code
    return $course_id;
}