Home › Forums › Legacy Support › Support queries › Other issues › Custom certificate shows incorrect code
- This topic has 24 replies, 2 voices, and was last updated 5 years, 8 months ago by Anshuman Sahu.
-
AuthorPosts
-
July 12, 2018 at 8:07 am #168928tutocaSpectatorYes 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=1Y47cGD59RA5CpsJtESEDf3H1MgcAonvLJuly 13, 2018 at 7:14 pm #169179Anshuman SahuKeymasteryes 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 .July 15, 2018 at 5:43 pm #169263tutocaSpectatorI 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.July 16, 2018 at 6:17 pm #169382Anshuman SahuKeymastersimply 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 .July 17, 2018 at 9:31 pm #169537tutocaSpectatorThat is a good solution for remove template ID. Now, how can I validate the code? The issue still there, validation is not working.July 18, 2018 at 5:44 pm #169657Anshuman SahuKeymasterwell 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 ? aJuly 19, 2018 at 12:50 pm #169804tutocaSpectatorSure, There will be just one template for all courses. I create courses from frontend and backend, priority is front end.July 20, 2018 at 3:08 pm #169973Anshuman SahuKeymasterOk please provide me some time to share the code with you . ping back for a reminder .July 31, 2018 at 3:01 am #170865tutocaSpectatorHi, Just a reminder.July 31, 2018 at 2:20 pm #170972Anshuman SahuKeymasteradd 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 .
-
AuthorPosts
- The topic ‘Custom certificate shows incorrect code’ is closed to new replies.