PluginProbe
Tutor LMS – eLearning and online course solution / 1.0.1
Tutor LMS – eLearning and online course solution v1.0.1
4.0.7 4.0.6 4.0.5 4.0.4 4.0.3 4.0.2 4.0.1 4.0.0 3.9.15 3.9.14 3.9.13 3.9.12 3.9.11 trunk 1.0.0 1.0.0-alpha 1.0.1 1.0.2 1.0.3 1.0.4 1.0.5 1.0.6 1.0.7 1.0.8 1.0.9 All 191 releases
← All changes | classes/Course.php +5 -20 1.0.41.0.1 View file →
@@ -8,9 +8,9 @@
8 8 public function __construct() {
9 9 parent::__construct();
10 10
11 11 add_action( 'add_meta_boxes', array($this, 'register_meta_box') );
12 - add_action('save_post_'.$this->course_post_type, array($this, 'save_course_meta'), 10, 2);
12 + add_action('save_post_'.$this->course_post_type, array($this, 'save_course_meta'));
13 13 add_action('wp_ajax_tutor_add_course_topic', array($this, 'tutor_add_course_topic'));
14 14 add_action('wp_ajax_tutor_update_topic', array($this, 'tutor_update_topic'));
15 15
16 16 //Add Column
@@ -63,9 +63,9 @@
63 63 * @param $post_ID
64 64 *
65 65 * Insert Topic and attached it with Course
66 66 */
67 - public function save_course_meta($post_ID, $post){
67 + public function save_course_meta($post_ID){
68 68 global $wpdb;
69 69 /**
70 70 * Insert Topic
71 71 */
@@ -169,18 +169,8 @@
169 169 $video = tutor_utils()->sanitize_array($_POST['video']);
170 170 update_post_meta($post_ID, '_video', $video);
171 171 }
172 172
173 - /**
174 - * Adding author to instructor automatically
175 - */
176 -
177 - $author_id = $post->post_author;
178 - $attached = (int) $wpdb->get_var(" SELECT COUNT(umeta_id) FROM {$wpdb->usermeta} WHERE user_id = {$author_id} AND meta_key = '_tutor_instructor_course_id' AND meta_value = {$post_ID} ");
179 - if ( ! $attached){
180 - add_user_meta($author_id, '_tutor_instructor_course_id', $post_ID);
181 - }
182 -
183 173 //Announcements
184 174 $announcement_title = tutor_utils()->avalue_dot('announcements.title', $_POST );
185 175 if ( ! empty($announcement_title)){
186 176 $title = sanitize_text_field(tutor_utils()->avalue_dot('announcements.title', $_POST ));
@@ -440,14 +430,14 @@
440 430
441 431 $instructors = array();
442 432
443 433
444 - $not_in_sql = apply_filters('tutor_instructor_query_when_exists', " AND ID <1 ");
445 -
434 + $not_in_sql = '';
446 435 if ($saved_instructors){
447 436 $saved_instructors_ids = wp_list_pluck($saved_instructors, 'ID');
448 437 $instructor_not_in_ids = implode(',', $saved_instructors_ids);
449 - $not_in_sql .= "AND ID NOT IN($instructor_not_in_ids) ";
438 + $activated = apply_filters('tutor_instructor_query_when_exists', " AND ID <1 ");
439 + $not_in_sql = $activated."AND ID NOT IN($instructor_not_in_ids) ";
450 440 }
451 441
452 442 $search_sql = '';
453 443 if ($search_terms){
@@ -469,13 +459,8 @@
469 459 $output .= '<p class="quiz-search-suggest-text">'.__('Search to get the specific instructors', 'tutor').'</p>';
470 460
471 461 }else{
472 462 $output .= __('No instructor available or you have already added maximum instructors', 'tutor');
473 - }
474 -
475 -
476 - if ( ! defined('TUTOR_MT_VERSION')){
477 - $output .= '<p class="tutor-notice-warning" style="margin-top: 50px; font-size: 14px;">'. sprintf( __('To add unlimited multiple instructors in your course, get %sTutor LMS Pro%s', 'tutor'), '<a href="https://www.themeum.com/product/tutor-lms" target="_blank">', "</a>" ) .'</p>';
478 463 }
479 464
480 465 wp_send_json_success(array('output' => $output));
481 466 }