Home › Forums › Legacy Support › Support queries › Setup issues › Quiz auto trigger fails to work
Tagged: Quiz auto trigger fails to work
- This topic has 19 replies, 3 voices, and was last updated 3 years, 11 months ago by Veronica.
-
AuthorPosts
-
December 13, 2020 at 7:06 pm #329205RMASpectatorThe quiz auto trigger fails to work. Stundent can take the quiz as many times but when they have made a passing score the quiz should trigger completion. I have tried adding code given by Jason and alex in the past but it fails to take. Error message 'rolledback due to too many argument". add_action('wp_footer',function ($quiz_id,$marks,$user_id){ ?> <script> function check_quiz_marks(){ var qid = jQuery('.course_timeline ul li.active a').data('unit'); jQuery.ajax({ type: "POST", url: ajaxurl, dataType: 'json', data: { action: 'check_quiz_marks', security: $('#hash').val(), quiz_id:qid, }, cache: false, success: function (json) { console.log(json); if(json && json.status){ var value= parseInt($('.course_progressbar').attr('data-value')); if(value >= 100){ $('input[name="submit_course"]').trigger('click'); }else{ $('input[name="submit_course"]').addClass('hide'); } } } }); } jQuery(document).ready(function($){ $('.unit_content').on('unit_traverse',function(){ check_quiz_marks(); console.log('unit_content'); }); $('.course_progressbar').on('increment',function(){ check_quiz_marks(); console.log('course_progressbar'); }); console.log('ahava me'); check_quiz_marks(); }); </script> <?php },10); add_action('wp_ajax_check_quiz_marks',function (){ $quiz_id= $_POST['quiz_id']; if ( !isset($_POST['security']) || !wp_verify_nonce($_POST['security'],'security') || !is_numeric($quiz_id)){ _e('Security check Failed. Contact Administrator.','vibe'); die(); } $user_id = get_current_user_id(); $passing_marks = get_post_meta($quiz_id,'vibe_quiz_passing_score',true); $marks = get_post_meta($quiz_id,$user_id,true); if($marks > $passing_marks){ echo json_encode(array( 'status' => 1, )); }else{ echo json_encode(array( 'status' => 0, )); } die(); });December 14, 2020 at 12:40 pm #329292VeronicaModeratorhi have tried adding code given by Jason and Alex in the past but it fails to take. have they provided the same on another topic? if yes then can you please share the topic link if you have one?December 15, 2020 at 6:45 pm #329544RMASpectatorThis reply has been marked as private.December 16, 2020 at 2:56 pm #329715Anshuman SahuKeymasterPlease make sure that you have disabled " auto trigger finish course " from wp-admin-> lms -> settings .December 17, 2020 at 5:24 am #329797RMASpectatorWill that mean that all other courses will no longer be able to use the auto finish mechanics. I have mixed courses. Some students can take quizzes as many times until l they have made the desired score other courses students simply make units complete to generate the certificate.December 17, 2020 at 2:49 pm #329924Anshuman SahuKeymasterWell if you enable " auto trigger finish course " then both of these codes , the setting and the custom code will work on the course status page and will create conflicts , the setting will override the code . This is I guess might be happening in your case. Are you using react quizzes?December 18, 2020 at 5:11 pm #330091RMASpectatorYes, I am using reactive quizzes.December 22, 2020 at 2:39 pm #330659Anshuman SahuKeymasterok please confirm if you want the user if they pass to quickly trigger the auto finish ? and if not then let them retake and do not trigger auto finish . Please also share the course url , admin and ftp credentials to check this further .December 28, 2020 at 8:13 pm #331466RMASpectatorThis reply has been marked as private.January 2, 2021 at 2:13 pm #332023Anshuman SahuKeymasterThis reply has been marked as private.January 4, 2021 at 2:38 am #332099RMASpectatorThis reply has been marked as private.January 4, 2021 at 3:18 pm #332207Anshuman SahuKeymasterHi please provide me some time to check and fix this for you .Apologies for the delay . Please ping back for a reminder .January 5, 2021 at 5:04 pm #332399RMASpectatorThis reply has been marked as private.January 6, 2021 at 3:04 pm #332542Anshuman SahuKeymasterYes its just that it needs time and resources to research and implement and its cost as well is a deciding factor for us .January 13, 2021 at 8:09 pm #333774RMASpectatorThis reply has been marked as private.
-
AuthorPosts
- The topic ‘Quiz auto trigger fails to work’ is closed to new replies.