Version Description
24 April, 2019 =
Added: few action hooks at the quiz
Added: a filter hook to support pro version more perfectly
Download this release
Release Info
Developer | themeum |
Plugin | Tutor LMS – eLearning and online course solution |
Version | 1.2.11 |
Comparing to | |
See all releases |
Code changes from version 1.2.1 to 1.2.11
- classes/Quiz.php +24 -4
- classes/Utils.php +4 -0
- readme.txt +6 -1
- tutor.php +3 -3
classes/Quiz.php
CHANGED
@@ -463,6 +463,7 @@ class Quiz {
|
|
463 |
|
464 |
$quiz_id = (int) sanitize_text_field($_POST['quiz_id']);
|
465 |
$attempt = tutor_utils()->is_started_quiz($quiz_id);
|
|
|
466 |
|
467 |
$attempt_info = array(
|
468 |
'total_answered_questions' => 0,
|
@@ -470,7 +471,10 @@ class Quiz {
|
|
470 |
'attempt_status' => 'attempt_ended',
|
471 |
'attempt_ended_at' => date("Y-m-d H:i:s"),
|
472 |
);
|
473 |
-
|
|
|
|
|
|
|
474 |
|
475 |
wp_redirect(tutor_utils()->input_old('_wp_http_referer'));
|
476 |
}
|
@@ -485,12 +489,17 @@ class Quiz {
|
|
485 |
$attempt = tutor_utils()->is_started_quiz($quiz_id);
|
486 |
|
487 |
if ($attempt) {
|
488 |
-
|
|
|
|
|
489 |
'attempt_status' => 'attempt_timeout',
|
490 |
'attempt_ended_at' => date("Y-m-d H:i:s"),
|
491 |
);
|
492 |
$wpdb->update($wpdb->prefix.'tutor_quiz_attempts', $data, array('attempt_id' => $attempt->attempt_id));
|
493 |
-
|
|
|
|
|
|
|
494 |
}
|
495 |
|
496 |
wp_send_json_error(__('Quiz has been timeout already', 'tutor'));
|
@@ -507,12 +516,13 @@ class Quiz {
|
|
507 |
$attempt_answer_id = (int) sanitize_text_field($_GET['attempt_answer_id']);
|
508 |
$mark_as = sanitize_text_field($_GET['mark_as']);
|
509 |
|
510 |
-
|
511 |
$attempt_answer = $wpdb->get_row("SELECT * FROM {$wpdb->prefix}tutor_quiz_attempt_answers WHERE attempt_answer_id = {$attempt_answer_id} ");
|
512 |
$attempt = tutor_utils()->get_attempt($attempt_id);
|
513 |
|
514 |
$is_correct = (int) $attempt_answer->is_correct;
|
515 |
|
|
|
|
|
516 |
if ($mark_as === 'correct' && ! $is_correct){
|
517 |
|
518 |
$answer_update_data = array(
|
@@ -545,6 +555,7 @@ class Quiz {
|
|
545 |
|
546 |
$wpdb->update($wpdb->prefix.'tutor_quiz_attempts', $attempt_update_data, array('attempt_id' => $attempt_id ));
|
547 |
}
|
|
|
548 |
|
549 |
wp_redirect(admin_url("admin.php?page=tutor_quiz_attempts&sub_page=view_attempt&attempt_id=".$attempt_id));
|
550 |
die();
|
@@ -570,6 +581,7 @@ class Quiz {
|
|
570 |
'menu_order' => $next_order_id,
|
571 |
);
|
572 |
$quiz_id = wp_insert_post( $post_arr );
|
|
|
573 |
|
574 |
ob_start();
|
575 |
include tutor()->path.'views/modal/edit_quiz.php';
|
@@ -598,6 +610,8 @@ class Quiz {
|
|
598 |
$post = get_post($quiz_id);
|
599 |
|
600 |
if ( $post->post_type === 'tutor_quiz'){
|
|
|
|
|
601 |
$wpdb->delete($wpdb->prefix.'tutor_quiz_attempts', array('quiz_id' => $quiz_id));
|
602 |
$wpdb->delete($wpdb->prefix.'tutor_quiz_attempt_answers', array('quiz_id' => $quiz_id));
|
603 |
|
@@ -610,6 +624,10 @@ class Quiz {
|
|
610 |
|
611 |
wp_delete_post($quiz_id, true);
|
612 |
delete_post_meta($quiz_id, '_tutor_course_id_for_lesson');
|
|
|
|
|
|
|
|
|
613 |
wp_send_json_success();
|
614 |
}
|
615 |
|
@@ -635,6 +653,8 @@ class Quiz {
|
|
635 |
);
|
636 |
$quiz_id = wp_update_post( $post_arr );
|
637 |
|
|
|
|
|
638 |
ob_start();
|
639 |
?>
|
640 |
<div class="tutor-lesson-top">
|
463 |
|
464 |
$quiz_id = (int) sanitize_text_field($_POST['quiz_id']);
|
465 |
$attempt = tutor_utils()->is_started_quiz($quiz_id);
|
466 |
+
$attempt_id = $attempt->attempt_id;
|
467 |
|
468 |
$attempt_info = array(
|
469 |
'total_answered_questions' => 0,
|
471 |
'attempt_status' => 'attempt_ended',
|
472 |
'attempt_ended_at' => date("Y-m-d H:i:s"),
|
473 |
);
|
474 |
+
|
475 |
+
do_action('tutor_quiz_before_finish', $attempt_id, $quiz_id, $attempt->user_id);
|
476 |
+
$wpdb->update($wpdb->prefix.'tutor_quiz_attempts', $attempt_info, array('attempt_id' => $attempt_id));
|
477 |
+
do_action('tutor_quiz_finished', $attempt_id, $quiz_id, $attempt->user_id);
|
478 |
|
479 |
wp_redirect(tutor_utils()->input_old('_wp_http_referer'));
|
480 |
}
|
489 |
$attempt = tutor_utils()->is_started_quiz($quiz_id);
|
490 |
|
491 |
if ($attempt) {
|
492 |
+
$attempt_id = $attempt->attempt_id;
|
493 |
+
|
494 |
+
$data = array(
|
495 |
'attempt_status' => 'attempt_timeout',
|
496 |
'attempt_ended_at' => date("Y-m-d H:i:s"),
|
497 |
);
|
498 |
$wpdb->update($wpdb->prefix.'tutor_quiz_attempts', $data, array('attempt_id' => $attempt->attempt_id));
|
499 |
+
|
500 |
+
do_action('tutor_quiz_timeout', $attempt_id, $quiz_id, $attempt->user_id);
|
501 |
+
|
502 |
+
wp_send_json_success();
|
503 |
}
|
504 |
|
505 |
wp_send_json_error(__('Quiz has been timeout already', 'tutor'));
|
516 |
$attempt_answer_id = (int) sanitize_text_field($_GET['attempt_answer_id']);
|
517 |
$mark_as = sanitize_text_field($_GET['mark_as']);
|
518 |
|
|
|
519 |
$attempt_answer = $wpdb->get_row("SELECT * FROM {$wpdb->prefix}tutor_quiz_attempt_answers WHERE attempt_answer_id = {$attempt_answer_id} ");
|
520 |
$attempt = tutor_utils()->get_attempt($attempt_id);
|
521 |
|
522 |
$is_correct = (int) $attempt_answer->is_correct;
|
523 |
|
524 |
+
do_action('tutor_quiz_review_answer_before', $attempt_answer_id, $attempt_id, $mark_as);
|
525 |
+
|
526 |
if ($mark_as === 'correct' && ! $is_correct){
|
527 |
|
528 |
$answer_update_data = array(
|
555 |
|
556 |
$wpdb->update($wpdb->prefix.'tutor_quiz_attempts', $attempt_update_data, array('attempt_id' => $attempt_id ));
|
557 |
}
|
558 |
+
do_action('tutor_quiz_review_answer_after', $attempt_answer_id, $attempt_id, $mark_as);
|
559 |
|
560 |
wp_redirect(admin_url("admin.php?page=tutor_quiz_attempts&sub_page=view_attempt&attempt_id=".$attempt_id));
|
561 |
die();
|
581 |
'menu_order' => $next_order_id,
|
582 |
);
|
583 |
$quiz_id = wp_insert_post( $post_arr );
|
584 |
+
do_action('tutor_initial_quiz_created', $quiz_id);
|
585 |
|
586 |
ob_start();
|
587 |
include tutor()->path.'views/modal/edit_quiz.php';
|
610 |
$post = get_post($quiz_id);
|
611 |
|
612 |
if ( $post->post_type === 'tutor_quiz'){
|
613 |
+
do_action('tutor_delete_quiz_before', $quiz_id);
|
614 |
+
|
615 |
$wpdb->delete($wpdb->prefix.'tutor_quiz_attempts', array('quiz_id' => $quiz_id));
|
616 |
$wpdb->delete($wpdb->prefix.'tutor_quiz_attempt_answers', array('quiz_id' => $quiz_id));
|
617 |
|
624 |
|
625 |
wp_delete_post($quiz_id, true);
|
626 |
delete_post_meta($quiz_id, '_tutor_course_id_for_lesson');
|
627 |
+
|
628 |
+
do_action('tutor_delete_quiz_after', $quiz_id);
|
629 |
+
|
630 |
+
|
631 |
wp_send_json_success();
|
632 |
}
|
633 |
|
653 |
);
|
654 |
$quiz_id = wp_update_post( $post_arr );
|
655 |
|
656 |
+
do_action('tutor_quiz_updated', $quiz_id);
|
657 |
+
|
658 |
ob_start();
|
659 |
?>
|
660 |
<div class="tutor-lesson-top">
|
classes/Utils.php
CHANGED
@@ -1690,7 +1690,11 @@ class Utils {
|
|
1690 |
public function mark_lesson_complete($post_id = 0, $user_id = 0){
|
1691 |
$post_id = $this->get_post_id($post_id);
|
1692 |
$user_id = $this->get_user_id($user_id);
|
|
|
|
|
1693 |
update_user_meta($user_id, '_tutor_completed_lesson_id_'.$post_id, time());
|
|
|
|
|
1694 |
}
|
1695 |
|
1696 |
/**
|
1690 |
public function mark_lesson_complete($post_id = 0, $user_id = 0){
|
1691 |
$post_id = $this->get_post_id($post_id);
|
1692 |
$user_id = $this->get_user_id($user_id);
|
1693 |
+
|
1694 |
+
do_action('tutor_mark_lesson_complete_before', $post_id, $user_id);
|
1695 |
update_user_meta($user_id, '_tutor_completed_lesson_id_'.$post_id, time());
|
1696 |
+
do_action('tutor_mark_lesson_complete_after', $post_id, $user_id);
|
1697 |
+
|
1698 |
}
|
1699 |
|
1700 |
/**
|
readme.txt
CHANGED
@@ -5,7 +5,7 @@ Tags: lms, course, elearning, education, quiz, training, sell courses, courses,
|
|
5 |
Requires at least: 4.5
|
6 |
Tested up to: 5.1
|
7 |
Requires PHP: 5.4.0
|
8 |
-
Stable tag: 1.2.
|
9 |
License: GPLv3
|
10 |
License URI: https://www.gnu.org/licenses/gpl-3.0.html
|
11 |
|
@@ -206,6 +206,11 @@ Tutor enables you to use any third party plugins without facing any compatibilit
|
|
206 |
|
207 |
== Changelog ==
|
208 |
|
|
|
|
|
|
|
|
|
|
|
209 |
= 1.2.1 - 23 April, 2019 =
|
210 |
|
211 |
* Added: email field type at withdrawals methods form generator
|
5 |
Requires at least: 4.5
|
6 |
Tested up to: 5.1
|
7 |
Requires PHP: 5.4.0
|
8 |
+
Stable tag: 1.2.11
|
9 |
License: GPLv3
|
10 |
License URI: https://www.gnu.org/licenses/gpl-3.0.html
|
11 |
|
206 |
|
207 |
== Changelog ==
|
208 |
|
209 |
+
= 1.2.11 - 24 April, 2019 =
|
210 |
+
|
211 |
+
* Added: few action hooks at the quiz
|
212 |
+
* Added: a filter hook to support pro version more perfectly
|
213 |
+
|
214 |
= 1.2.1 - 23 April, 2019 =
|
215 |
|
216 |
* Added: email field type at withdrawals methods form generator
|
tutor.php
CHANGED
@@ -4,7 +4,7 @@ Plugin Name: Tutor LMS
|
|
4 |
Plugin URI: http://https://themeum.com/tutor
|
5 |
Description: Tutor is a complete solution for creating a Learning Management System in WordPress way. It can help you to create small to large scale online education site very conveniently. Power features like report, certificate, course preview, private file sharing make Tutor a robust plugin for any educational institutes.
|
6 |
Author: Themeum
|
7 |
-
Version: 1.2.
|
8 |
Author URI: http://themeum.com
|
9 |
Requires at least: 4.5
|
10 |
Tested up to: 5.1
|
@@ -17,7 +17,7 @@ if ( ! defined( 'ABSPATH' ) )
|
|
17 |
/**
|
18 |
* Defined the tutor main file
|
19 |
*/
|
20 |
-
define('TUTOR_VERSION', '1.2.
|
21 |
define('TUTOR_FILE', __FILE__);
|
22 |
|
23 |
|
@@ -52,7 +52,7 @@ if ( ! function_exists('tutor')) {
|
|
52 |
'instructor_role' => apply_filters( 'tutor_instructor_role', 'tutor_instructor' ),
|
53 |
'instructor_role_name' => apply_filters( 'tutor_instructor_role_name', __( 'Tutor Instructor', 'tutor' ) ),
|
54 |
'template_path' => apply_filters( 'tutor_template_path', 'tutor/' ),
|
55 |
-
'has_pro' => $hasPro,
|
56 |
);
|
57 |
|
58 |
return (object) $info;
|
4 |
Plugin URI: http://https://themeum.com/tutor
|
5 |
Description: Tutor is a complete solution for creating a Learning Management System in WordPress way. It can help you to create small to large scale online education site very conveniently. Power features like report, certificate, course preview, private file sharing make Tutor a robust plugin for any educational institutes.
|
6 |
Author: Themeum
|
7 |
+
Version: 1.2.11
|
8 |
Author URI: http://themeum.com
|
9 |
Requires at least: 4.5
|
10 |
Tested up to: 5.1
|
17 |
/**
|
18 |
* Defined the tutor main file
|
19 |
*/
|
20 |
+
define('TUTOR_VERSION', '1.2.11');
|
21 |
define('TUTOR_FILE', __FILE__);
|
22 |
|
23 |
|
52 |
'instructor_role' => apply_filters( 'tutor_instructor_role', 'tutor_instructor' ),
|
53 |
'instructor_role_name' => apply_filters( 'tutor_instructor_role_name', __( 'Tutor Instructor', 'tutor' ) ),
|
54 |
'template_path' => apply_filters( 'tutor_template_path', 'tutor/' ),
|
55 |
+
'has_pro' => apply_filters( 'tutor_has_pro', $hasPro),
|
56 |
);
|
57 |
|
58 |
return (object) $info;
|