} else { echo '<a class="button create-group-button full"> ' . __('Take a Course to Start the Quiz', 'vibe') . '</a>'; } ?> </div> </div> </div> </div> </section> <section id="content"> <div class="container"> <div class="row"> <div class="col-md-9"> <div class="content"> <?php the_quiz(); do_action('wplms_front_end_quiz_controls'); ?> </div> </div> <div class="col-md-3 quiz-sidebar"> <div class="quiz_details"> <?php the_quiz_timer(); the_quiz_timeline(); ?> </div> <?php do_action('wplms_front_end_quiz_meta_controls'); ?> </div>
function continue_quiz() { $user_id = get_current_user_id(); $quiztaken = get_user_meta($user_id, get_the_ID(), true); if (isset($_POST['start_quiz']) && wp_verify_nonce($_POST['start_quiz'], 'start_quiz')) { // Same NONCE just for validation if (isset($quiztaken) && $quiztaken && $quiztaken > time()) { $questions = vibe_sanitize(get_post_meta($id, 'quiz_questions' . $user_id, false)); if (!isset($questions) || !is_array($questions)) { $questions = vibe_sanitize(get_post_meta($id, 'vibe_quiz_questions', false)); } the_quiz('quiz_id=' . get_the_ID() . '&ques_id=' . $questions['ques'][0]); } else { echo '<div class="message error"><h3>' . __('Quiz Timed Out .', 'vibe') . '</h3>'; echo '<p>' . __('If you want to attempt again, Contact Instructor to reset the quiz.', 'vibe') . '</p></div>'; } } else { echo '<div class="message error"><h3>' . __('Quiz Already Attempted .', 'vibe') . '</h3>'; echo '<p>' . __('If you want to attempt again, Contact Instructor to reset the quiz.', 'vibe') . '</p></div>'; } die; }
function preview_element() { $course_id = $_POST['course_id']; if (!isset($_POST['security']) || !wp_verify_nonce($_POST['security'], 'security') || !current_user_can('edit_posts') || !is_numeric($_POST['element_id'])) { _e('Security check Failed. Contact Administrator.', 'wplms-front-end'); die; } $post_type = get_post_type($_POST['element_id']); ?> <div class="element_overlay"> <span class="close-pop dashicons dashicons-no-alt"></span> <?php if ($post_type == 'unit') { the_unit($_POST['element_id']); } else { if ($post_type == 'quiz') { the_quiz(array('quiz_id' => $_POST['element_id'])); } else { echo apply_filters('the_content', get_post_field('post_content', $_POST['element_id'])); } } $buttons = array(array('label' => __('FULL PREVIEW & STATS', 'vibe'), 'id' => 'preview_element_button', 'href' => get_permalink($_POST['element_id']), 'type' => 'small_button'), array('label' => __('Close', 'vibe'), 'id' => 'close_element_button', 'type' => 'small_button')); foreach ($buttons as $button) { WPLMS_Front_End_Fields::generate_fields($button, $_POST['element_id']); } ?> </div> <?php die; }