pluginHelper->register_quiz_settings_tabs( __( 'Questions', 'quiz-master-next' ), 'qsm_options_questions_tab_content' ); } add_action( 'plugins_loaded', 'qsm_settings_questions_tab', 5 ); /** * Adds the content for the options for questions tab. * * @return void * @since 4.4.0 */ function qsm_options_questions_tab_content() { global $wpdb; global $mlwQuizMasterNext; $quiz_id = intval( $_GET['quiz_id'] ); $user_id = get_current_user_id(); $json_data = array( 'quizID' => $quiz_id, 'answerText' => __( 'Answer', 'quiz-master-next' ), 'nonce' => wp_create_nonce( 'wp_rest' ), 'pages' => $mlwQuizMasterNext->pluginHelper->get_quiz_setting( 'pages', array() ), 'qsm_user_ve' => get_user_meta($user_id, 'rich_editing', true) ); // Scripts and styles. wp_enqueue_script( 'micromodal_script', plugins_url( '../../js/micromodal.min.js', __FILE__ ) ); wp_enqueue_script( 'qsm_admin_question_js', plugins_url( '../../js/qsm-admin-question.js', __FILE__ ), array( 'backbone', 'underscore', 'jquery-ui-sortable', 'wp-util', 'micromodal_script', 'qmn_admin_js' ), $mlwQuizMasterNext->version, true ); wp_localize_script( 'qsm_admin_question_js', 'qsmQuestionSettings', $json_data ); wp_enqueue_style( 'qsm_admin_question_css', plugins_url( '../../css/qsm-admin-question.css', __FILE__ ), array(), $mlwQuizMasterNext->version ); wp_enqueue_script( 'math_jax', '//cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-AMS-MML_HTMLorMML' ); wp_enqueue_editor(); wp_enqueue_media(); // Load Question Types. $question_types = $mlwQuizMasterNext->pluginHelper->get_question_type_options(); // Display warning if using competing options. $pagination = $mlwQuizMasterNext->pluginHelper->get_section_setting( 'quiz_options', 'pagination' ); if ( 0 != $pagination ) { ?>
This quiz has the "How many questions per page would you like?" option enabled. The pages below will not be used while that option is enabled. To turn off, go to the "Options" tab and set that option to 0.
This quiz has the "How many questions should be loaded for quiz?" option enabled. The pages below will not be used while that option is enabled. To turn off, go to the "Options" tab and set that option to 0.
This quiz has the "Are the questions random?" option enabled. The pages below will not be used while that option is enabled. To turn off, go to the "Options" tab and set that option to "No".
Use this tab to create and modify the different pages of your quiz or survey as well as the questions on each page. Click "Create New Page" to get started! Need more information? Check out the documentation for this tab!
'error', ); $quiz_id = intval( $_POST['quiz_id'] ); $mlwQuizMasterNext->pluginHelper->prepare_quiz( $quiz_id ); $response = $mlwQuizMasterNext->pluginHelper->update_quiz_setting( 'pages', $_POST['pages'] ); if ( $response ) { $json['status'] = 'success'; } echo wp_json_encode( $json ); wp_die(); } add_action( 'wp_ajax_qsm_load_all_quiz_questions', 'qsm_load_all_quiz_questions_ajax' ); //add_action( 'wp_ajax_nopriv_qsm_load_all_quiz_questions', 'qsm_load_all_quiz_questions_ajax' ); /** * Loads all the questions and echos out JSON * * @since 0.1.0 * @return void */ function qsm_load_all_quiz_questions_ajax() { global $wpdb; global $mlwQuizMasterNext; // Loads questions. $questions = $wpdb->get_results( "SELECT question_id, question_name FROM {$wpdb->prefix}mlw_questions WHERE deleted = '0' ORDER BY question_id DESC" ); // Creates question array. $question_json = array(); foreach ( $questions as $question ) { $question_json[] = array( 'id' => $question->question_id, 'question' => $question->question_name, ); } // Echos JSON and dies. echo wp_json_encode( $question_json ); wp_die(); } add_action( 'wp_ajax_qsm_send_data_sendy', 'qsm_send_data_sendy' ); //add_action( 'wp_ajax_nopriv_qsm_send_data_sendy', 'qsm_send_data_sendy' ); /** * @version 6.3.2 * Send data to sendy */ function qsm_send_data_sendy(){ $sendy_url = 'http://sendy.expresstech.io'; $list = '4v8zvoyXyTHSS80jeavOpg'; $name = sanitize_text_field($_POST['name']); $email = sanitize_email($_POST['email']); //subscribe $postdata = http_build_query( array( 'name' => $name, 'email' => $email, 'list' => $list, 'boolean' => 'true' ) ); $opts = array('http' => array('method' => 'POST', 'header' => 'Content-type: application/x-www-form-urlencoded', 'content' => $postdata)); $context = stream_context_create($opts); $result = wp_remote_post($sendy_url.'/subscribe', [ 'body' => array( 'name' => $name, 'email' => $email, 'list' => $list, 'boolean' => 'true' ) ] ); echo isset($result['response']) && isset($result['response']['code']) && $result['response']['code'] == 200 ? $result['body'] : ''; exit; } ?>