Custom certificate shows incorrect code

Home Forums Legacy Support Support queries Other issues Custom certificate shows incorrect code

Viewing 10 posts - 16 through 25 (of 25 total)
  • Author
    Posts
  • #168928
    tutoca
    Spectator
    Yes I saw that, in that specific case works, but is misleading, since only works because a certificate template has been previously chosen, although it has not been chosen at the moment. However, if a new course is created, and a certificate template is never chosen, the default certificate for some reason does not show the correct code. The code only is shown correctly, if previously the template was chosen at some point, even if it is not currently chosen, it is a bit tricky. You can try: - Create a new course (never choose a certificate template) And the issue will be shown when certificate is generated for user. Again I have replicated the issue when creating a new course: https://drive.google.com/open?id=1Y47cGD59RA5CpsJtESEDf3H1MgcAonvL
    #169179
    Anshuman Sahu
    Keymaster
    yes you are right .ACtually the first number before first " - " is the id of the certificate template itself . Somehow the wordpress get_the_ID() function is outputting that H there . we can set a default certificate template if there is not any there to tackle this .
    #169263
    tutoca
    Spectator
    I think it's a great idea! As an additional comment, since the template ID will always be the same, it would be better to remove that number, leaving only the rest. E.g, instead of: 5219-1720-24 Could be: 1720-24 I only want one default template, I don't want to choose an option. The main point is the validation must work, then I can proceed with certificate design.
    #169382
    Anshuman Sahu
    Keymaster
    simply add this code in your wplms-customizer.php file in wplms customizer plugin :   add_filter('wplms_certificate_code',function($code,$cid,$uid){   return $cid.'-'.$uid; },10,3);     it will remove template id .
    #169537
    tutoca
    Spectator
    That is a good solution for remove template ID. Now, how can I validate the code? The issue still there, validation is not working.
    #169657
    Anshuman Sahu
    Keymaster
    well then we should go for the other method ,i.e to set a custom certificate template in course by default . for that please tell me would you like to change the certificate templates for some courses or there will be just one template for all your courses ?   Also tell from where do you create your courses ? front end course creation or back end ? a
    #169804
    tutoca
    Spectator
    Sure, There will be just one template for all courses. I create courses from frontend and backend, priority is front end.
    #169973
    Anshuman Sahu
    Keymaster
    Ok please provide me some time to share the code with you . ping back for a reminder .
    #170865
    tutoca
    Spectator
    Hi, Just a reminder.
    #170972
    Anshuman Sahu
    Keymaster
    add this one in wplms-customizer.php file in wplms customizer plugin at the end :   add_action( 'wp_insert_post', function($post_ID, $post, $update){ $check = get_post_meta($post_ID,'vibe_certificate_template',true); if(empty( $check)){ update_post_meta($post_ID,'vibe_certificate_template',78); } },10,3);   add_action( 'save_course', function($post_ID){ $check = get_post_meta($post_ID,'vibe_certificate_template',true); if(empty( $check)){ update_post_meta($post_ID,'vibe_certificate_template',78); } });       replace 78 with your certificate template id .
Viewing 10 posts - 16 through 25 (of 25 total)
  • The topic ‘Custom certificate shows incorrect code’ is closed to new replies.