Hide quizzes when passed

Home Forums Legacy Support Support queries Setup issues Hide quizzes when passed

Viewing 12 posts - 1 through 12 (of 12 total)
  • Author
    Posts
  • #336734
    Hi, I want to hide quizzes when student pass them. You gave me the following code in order to remove retake button when quiz is passed, but if in course pageyou click on the left on the same quiz in the curriculum, it's possible to retake it. How to block the quiz retake from curriculum? Thanks add_filter('wplms_quiz_retake_count','remove_retake_button_if_user_passed_the_quiz',10,4); function remove_retake_button_if_user_passed_the_quiz($retakes,$quiz_id,$course,$user_id){ $user_marks=get_post_meta($quiz_id,$user_id,true); $quiz_passing_marks=get_post_meta($quiz_id,'vibe_quiz_passing_score',true); if(empty($quiz_passing_marks)) return $retakes; if($user_marks >= $quiz_passing_marks) return 0; else return $retakes; }
    #337221
    Ada
    Participant
    Hi Use this code instead of that. add this code in wplms-customizer.php
    
    add_filter('wplms_quiz_retake_count','remove_retake_button_if_user_passed_the_quiz',10,4);
    
    function remove_retake_button_if_user_passed_the_quiz($retakes,$quiz_id,$course,$user_id){
    
     $user_marks=get_post_meta($quiz_id,$user_id,true);
    
     $quiz_passing_marks=get_post_meta($quiz_id,'vibe_quiz_passing_score',true);
    
     if(empty($quiz_passing_marks))
    
        return $retakes;
    
     if($user_marks >= $quiz_passing_marks){
      ?>
      <style>
     .vibebp_main .incourse.quiz_retake {
        display:none !important;
    }
    </style>
    <?php
       return 0;}
     
    
     else
    
       return $retakes;
    
    }
    
    #337362
    Hi Ada, thank you for your code. Now on the left on curriculum, passed quizzes are blocked, but button retake quiz is still there,and also the number of remaining retakes. If you click on it nothing happens, the program is searching. Is it possible hide retake button and number of remaining retakes? http://prnt.sc/xxvn31
    #337463
    Ada
    Participant
    Hi Here in this topic I shared updated code with you but you did not add it in wplms-customizer.php . You missed this part
    
    if($user_marks >= $quiz_passing_marks){
      ?>
      <style>
        
     .vibebp_main .course_status .incourse .quiz_retake{
        display:none !important;
    }
    </style>
    <?php
       return 0;}
    
    I added the code at your site and see it does not show retake button now. https://drive.google.com/file/d/10CR4Qp6JOz2oUXurv0njnxCpKegL0DEd/view
    #337567
    Hi Ada, sorry for my distraction. Unfortunately I continue to see retake button, even if quiz is passed. Moreaover, I noticed that the icons I removed: flag, bookmraks etc. sometimes reappear(as you can see in the image below). http://prnt.sc/xzqc8l
    #337622
    Ada
    Participant
    Hi, Pleas recheck as I did not found flags and bookmark anywhere in the quiz while testing. For this retake button I am rechecking the code .
    #338478
    Hi Ada, did you checked the code to hide retake button once passed quiz? Thank you
    #338734
    Ada
    Participant
    Hi, Yes I checked it. Sorry to say but this is all I can provide for this issue. This does not remove the retake button just after submitting but disables the button and when refreshing the page retake button is removed. The code I shared in the last reply was not working so I replaced it with the original one at your site. https://prntscr.com/yp3tx6 One thing I noticed that you have added duplicate code of the above here https://prntscr.com/yp3ua1 So you can remove it as it's unnecessary.
    #338810
    Hi Ada, thank you so much for your assitance. I checked my quizzes, if you refresh page you automatically go out from course. I have a lot of quizzes and for each one passed you have to go out and access again to continue course. I thing it's better to leave button. I may add a message when quiz is passed in which I invite to go ahead. The most important thing is hide quiz once passed. I have a big issue (alread asked your support and still waiting for a solution): If you set a passing score and totalize the same passing score you passed quiz, but your message says fail. Thank you for your support
    #338981
    Ada
    Participant
    Yes it is better to add a message to move forward when user passes the quiz. Your other issue will be solved soon in related topic. Please confirm can we close this topic now?
    #339064
    Yes, please close the topic
    #339180
    Veronica
    Moderator
    thanks for confirmation closing this topic
Viewing 12 posts - 1 through 12 (of 12 total)
  • The topic ‘Hide quizzes when passed’ is closed to new replies.