Quiz auto trigger fails to work

Home Forums Legacy Support Support queries Setup issues Quiz auto trigger fails to work

Viewing 15 posts - 1 through 15 (of 20 total)
  • Author
    Posts
  • #329205
    RMA
    Spectator
    The 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(); });
    #329292
    Veronica
    Moderator
    hi 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?
    #329544
    RMA
    Spectator
    This reply has been marked as private.
    #329715
    Anshuman Sahu
    Keymaster
    Please make sure that you have disabled " auto trigger finish course " from wp-admin-> lms -> settings .
    #329797
    RMA
    Spectator
    Will 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.
    #329924
    Anshuman Sahu
    Keymaster
    Well 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?
    #330091
    RMA
    Spectator
    Yes, I am using reactive quizzes.
    #330659
    Anshuman Sahu
    Keymaster
    ok 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 .
    #331466
    RMA
    Spectator
    This reply has been marked as private.
    #332023
    Anshuman Sahu
    Keymaster
    This reply has been marked as private.
    #332099
    RMA
    Spectator
    This reply has been marked as private.
    #332207
    Anshuman Sahu
    Keymaster
    Hi please provide me some time to check and fix this for you .Apologies for the delay . Please ping back for a reminder .
    #332399
    RMA
    Spectator
    This reply has been marked as private.
    #332542
    Anshuman Sahu
    Keymaster
    Yes its just that it needs time and resources to research and implement and its cost as well is a deciding factor for us .
    #333774
    RMA
    Spectator
    This reply has been marked as private.
Viewing 15 posts - 1 through 15 (of 20 total)
  • The topic ‘Quiz auto trigger fails to work’ is closed to new replies.