Problem with hide results code and hide retake quiz button after passing quiz

Home Forums Legacy Support Support queries How-to & Troubleshooting Problem with hide results code and hide retake quiz button after passing quiz

Viewing 8 posts - 16 through 23 (of 23 total)
  • Author
    Posts
  • #230840
    dianaw84
    Spectator
    Any news about it?
    #230895
    logan
    Member
    Share the credentials of user and admin in a private reply. Also share me the course url. I will test and let you know
    #231033
    dianaw84
    Spectator
    This reply has been marked as private.
    #231169
    logan
    Member
    This reply has been marked as private.
    #231181
    dianaw84
    Spectator
    Hi, I setted the quiz "test test" as passing score 2/3. If I pass quiz with 3/3 score, the button "retake quiz" disappears (it is right). Check video: https://screencast-o-matic.com/watch/cq6Zj9uHvR While, if I pass quiz with 2/3 (minimum score to pass), quiz is passed but the button "retake quiz" appears (it is wrong). Check video: https://screencast-o-matic.com/watch/cq6ZQcuHwX P.S.: Into the final message quiz, I need to have this shortcode [vibe_quiz_retake quiz="id"] inside the "not passed quiz message" shortcode (for example [pass_fail id = "id" fail = 1] Sorry, but you didn't pass the test.[vibe_quiz_retake quiz="id"] [/pass_fail], for those who don't pass quiz. Thank you
    #231273
    logan
    Member
    Hello, please replace the above code in the customizer plugin with this one. add_filter('wplms_quiz_retakes_left','wplms_passed_quiz_retakes',10,2); function wplms_passed_quiz_retakes($remaining_retakes,$quiz_id){ $passing_score = get_post_meta($quiz_id,'vibe_quiz_passing_score',true); if(isset($passing_score) && is_numeric($passing_score)){ $user_id = get_current_user_id(); $score = get_post_meta($quiz_id,$user_id,true); if($score >= $passing_score){ return 0; } } return $remaining_retakes; } this should do the trick.
    the thing you are asking that comes under customization request. we are full of querries, i will write a shortcode later. please remind me after diwali holidays in india. thanks for your patience.
    #231329
    dianaw84
    Spectator
    Ok thank you. Unfortunately, after copied and pasted your code, the situation didn't change: if a student gets the minimum score to pass the quiz, he passes the quiz but the retake quiz button appears again. Ok I'll remind you for the shortcode, meanwhile I wish you good holidays!
    #231362
    logan
    Member

    Hello,

    please replace the above code in the customizer plugin with this one.

    add_filter('wplms_quiz_retakes_left','wplms_passed_quiz_retakes',10,2);

    function wplms_passed_quiz_retakes($remaining_retakes,$quiz_id){

    $passing_score = get_post_meta($quiz_id,'vibe_quiz_passing_score',true);

    if(isset($passing_score) && is_numeric($passing_score)){

    $user_id = get_current_user_id();

    $score = get_post_meta($quiz_id,$user_id,true);

    if($score >= $passing_score){

    return FALSE;

    }

    }

    return $remaining_retakes;

    }

    this should do the trick.

Viewing 8 posts - 16 through 23 (of 23 total)
  • The topic ‘Problem with hide results code and hide retake quiz button after passing quiz’ is closed to new replies.