For quiz, we can add something like this in child theme functions.php :

The end part of the quiz can be easily controlled by quiz timer.

Part 1 : Add Quiz start time in Quiz options panel, note currently this would only work in WP Admin panel.


PHP Code:


 

add_filter('wplms_quiz_metabox','wplms_add_quiz_start_date');
function wplms_add_quiz_start_date($metabox){

$metabox['vibe_quiz_start_date'] = array( // Text Input
            'label'    => __('Quiz Start Date','vibe-customtypes'), // <label>
            'desc'    => __('Date from which Quiz Begins','vibe-customtypes'), // description
            'id'    => 'vibe_quiz_start_date', // field id and name
            'type'    => 'date', // type of field
        );

return $metabox;
}  

 

Part 2 : Check this Quiz start time.

PHP Code:


 

add_action('wplms_before_quiz','wplms_quiz_start_date');

function wplms_quiz_start_date(){
   $id = get_the_ID();
    $start_date = get_post_meta($id,'vibe_quiz_start_date',true);
   if(isset($start_date) && $start_date){
        $start_time = strtotime($start_date);
       if($start_time > time()){
           wp_die('Quiz can not be started');
       }
   }

}