• Is there a way to make the ‘complete quiz’ button visible only at the last page of the quiz with CSS? Is there a special class to differentiate the last from the previous pages of the quiz?

    • This topic was modified 4 years, 8 months ago by evangv.
    • This topic was modified 4 years, 8 months ago by evangv.
Viewing 4 replies - 1 through 4 (of 4 total)
  • Hi evangv,

    Unfortunately now you can’t use the CSS for this case, you need to change the source code to change it.
    So sorry for this inconvenience.

    Thread Starter evangv

    (@evangv)

    For those who are interested in this modification, you can edit the complete.php file located in wp-content > themes > eduma > learnpress-v3 > content-quiz > buttons.

    <?php
    /**
     * Template for displaying Complete button in quiz.
     *
     * This template can be overridden by copying it to yourtheme/learnpress/content-quiz/buttons/complete.php.
     *
     * @author  ThimPress
     * @package  Learnpress/Templates
     * @version  3.0.0
     */
    
    /**
     * Prevent loading this file directly
     */
    defined( 'ABSPATH' ) || exit();
    
    ?>
    
    <?php 
    
    $quiz = LP_Global::course_item_quiz(); 
    
    /* start edit */
    $current_question_id = $quiz->get_viewing_question( 'id' );
    $next_id = $quiz->get_next_question($current_question_id); 
    /* finish edit */
    
    ?>
    
    <?php/* start edit */?> 
    <?php if ( !$next_id  ) { ?>
    <?php/* finish edit */?> 
    
    <?php do_action( 'learn-press/quiz/before-complete-button' ); ?>
    
        <form name="complete-quiz" class="complete-quiz form-button lp-form" method="post" enctype="multipart/form-data">
    
    		<?php do_action( 'learn-press/quiz/begin-complete-button' ); ?>
    
            <button type="submit" class="button-finish-quiz"><?php _e( 'Complete', 'eduma' ); ?></button>
    
    		<?php do_action( 'learn-press/quiz/end-complete-button' ); ?>
    
    		<?php LP_Nonce_Helper::quiz_action( 'complete', $quiz->get_id(), get_the_ID() ); ?>
            <input type="hidden" name="noajax" value="yes">
    
        </form>
    
    <?php do_action( 'learn-press/quiz/after-complete-button' ); ?>
    
    <?php/* start edit */?> 
    <?php } ?>
    <?php/* finish edit */?> 

    Thank you so much for this!

    Except I just realized they can also complete the lesson without watching by hitting the complete button. so what would the code be to have it off every lesson and quiz, except the last quiz? Thank you, @evangv !

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘Make ‘Complete Quiz’ button visible only on last page of quiz’ is closed to new replies.