| @@ -22,8 +22,16 @@ | ||
| 22 | 22 | add_action('load-post.php', array($this, 'check_if_current_users_post') ); |
| 23 | 23 | |
| 24 | 24 | add_action('admin_action_uninstall_tutor_and_erase', array($this, 'erase_tutor_data')); |
| 25 | 25 | add_filter('plugin_action_links_' . plugin_basename(TUTOR_FILE), array( $this, 'plugin_action_links' ) ); |
| 26 | + | |
| 27 | + //Plugin Row Meta | |
| 28 | + add_filter('plugin_row_meta', array($this, 'plugin_row_meta'), 10, 2); | |
| 29 | + | |
| 30 | + //Admin Footer Text | |
| 31 | + add_filter( 'admin_footer_text', array( $this, 'admin_footer_text' ), 1 ); | |
| 32 | + //Register Course Widget | |
| 33 | + add_action( 'widgets_init', array($this, 'register_course_widget') ); | |
| 26 | 34 | } |
| 27 | 35 | |
| 28 | 36 | public function register_menu(){ |
| 29 | 37 | $hasPro = tutor()->has_pro; |
| @@ -35,10 +43,17 @@ | ||
| 35 | 43 | } |
| 36 | 44 | |
| 37 | 45 | $course_post_type = tutor()->course_post_type; |
| 38 | 46 | |
| 39 | - add_menu_page(__('Tutor LMS', 'tutor'), __('Tutor LMS', 'tutor'), 'manage_tutor_instructor', 'tutor', null, 'dashicons-welcome-learn-more', 2); | |
| 47 | + $pro_text = ''; | |
| 48 | + if ($hasPro){ | |
| 49 | + $pro_text = ' '.__('Pro', 'tutor'); | |
| 50 | + } | |
| 40 | 51 | |
| 52 | + $enable_course_marketplace = (bool) tutils()->get_option('enable_course_marketplace'); | |
| 53 | + | |
| 54 | + add_menu_page(__('Tutor LMS', 'tutor').$pro_text, __('Tutor LMS', 'tutor').$pro_text, 'manage_tutor_instructor', 'tutor', null, | |
| 55 | + 'data:image/svg+xml;base64,' . base64_encode('<svg fill="none" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 1000 1139"><defs/><path fill-rule="evenodd" clip-rule="evenodd" d="M341.652 622.4c-23.412 0-43.222-19.8-43.222-43.2v-99c0-23.4 19.81-43.2 43.222-43.2 23.412 0 43.222 19.8 43.222 43.2v99c0 23.4-18.009 43.2-43.222 43.2 1.801 0 1.801 0 0 0zM655.01 622.4c-23.412 0-43.222-18-43.222-43.2v-99c0-23.4 19.81-43.2 43.222-43.2 23.412 0 43.222 19.8 43.222 43.2v99c0 25.2-19.81 43.2-43.222 43.2z" fill="#9DA2A8"/><path fill-rule="evenodd" clip-rule="evenodd" d="M255.204 406.4c18.009-37.8 54.028-63 95.449-63 61.231 1.8 108.055 52.2 106.254 113.4v203.4c3.602 21.6 23.412 37.8 45.023 34.2 18.009-1.8 32.416-16.2 34.217-34.2V455c-1.801-61.2 46.824-111.6 106.254-113.4 39.621 0 75.639 21.6 93.648 59.4 68.435 133.2 14.407 295.2-117.06 363.6C487.523 833 325.44 779 258.806 647.6c-39.62-75.6-39.62-165.6-3.602-241.2zM426.291 140h151.277v59.4c-25.212-5.4-52.226-9-77.439-9-25.213 0-50.426 3.6-75.639 7.2l1.801-57.6zm414.211 388.8c0-122.4-66.634-235.8-172.888-295.2V140h64.833c25.213 0 45.023-19.8 45.023-45s-21.611-45-45.023-45H271.413C246.2 51.8 226.39 71.6 226.39 96.8c0 25.2 19.81 45 45.023 45h66.633v91.8c-163.883 90-230.517 298.8-135.068 459 3.602 5.4-3.602-5.4 0 0C338.046 930.2 687.424 948.2 802.683 950c10.805 0 19.81-3.6 27.014-10.8 7.203-7.2 10.805-18 10.805-27V528.8z" fill="#9DA2A8"/></svg>'), 2); | |
| 41 | 56 | add_submenu_page('tutor', __('Categories', 'tutor'), __('Categories', 'tutor'), 'manage_tutor', 'edit-tags.php?taxonomy=course-category&post_type='.$course_post_type, null ); |
| 42 | 57 | |
| 43 | 58 | add_submenu_page('tutor', __('Tags', 'tutor'), __('Tags', 'tutor'), 'manage_tutor', 'edit-tags.php?taxonomy=course-tag&post_type='.$course_post_type, null ); |
| 44 | 59 | |
| @@ -43,32 +58,33 @@ | ||
| 43 | 58 | add_submenu_page('tutor', __('Tags', 'tutor'), __('Tags', 'tutor'), 'manage_tutor', 'edit-tags.php?taxonomy=course-tag&post_type='.$course_post_type, null ); |
| 44 | 59 | |
| 45 | 60 | add_submenu_page('tutor', __('Students', 'tutor'), __('Students', 'tutor'), 'manage_tutor', 'tutor-students', array($this, 'tutor_students') ); |
| 46 | 61 | |
| 47 | - add_submenu_page('tutor', __('Instructors', 'tutor'), __('Instructors', 'tutor'), 'manage_tutor', 'tutor-instructors', array($this, 'tutor_instructors') ); | |
| 62 | + if ($enable_course_marketplace) { | |
| 63 | + add_submenu_page('tutor', __('Instructors', 'tutor'), __('Instructors', 'tutor'), 'manage_tutor', Instructors_List::INSTRUCTOR_LIST_PAGE, array($this, 'tutor_instructors')); | |
| 64 | + } | |
| 65 | + | |
| 66 | + add_submenu_page('tutor', __('Announcements', 'tutor'), __('Announcements', 'tutor'), 'manage_tutor_instructor', 'tutor_announcements', array($this, 'tutor_announcements')); | |
| 48 | 67 | |
| 49 | - add_submenu_page('tutor', __('Q & A', 'tutor'), __('Q & A '.$unanswered_bubble, 'tutor'), 'manage_tutor_instructor', 'question_answer', array($this, 'question_answer') ); | |
| 68 | + add_submenu_page('tutor', __('Q & A', 'tutor'), __('Q & A '.$unanswered_bubble, 'tutor'), 'manage_tutor_instructor', Question_Answers_List::Question_Answer_PAGE, array($this, 'question_answer') ); | |
| 50 | 69 | |
| 51 | - add_submenu_page('tutor', __('Quiz Attempts', 'tutor'), __('Quiz Attempts', 'tutor'), 'manage_tutor_instructor', 'tutor_quiz_attempts',array($this, 'quiz_attempts') ); | |
| 70 | + add_submenu_page('tutor', __('Quiz Attempts', 'tutor'), __('Quiz Attempts', 'tutor'), 'manage_tutor_instructor', Quiz_Attempts_List::QUIZ_ATTEMPT_PAGE, array($this, 'quiz_attempts') ); | |
| 52 | 71 | |
| 53 | - //add_submenu_page('tutor', __('Add-ons', 'tutor'), __('Add-ons', 'tutor'), 'manage_tutor', 'tutor-addons', array(new Addons(),'addons_page') ); | |
| 72 | + if ($enable_course_marketplace){ | |
| 73 | + add_submenu_page('tutor', __('Withdraw Requests', 'tutor'), __('Withdraw Requests', 'tutor'), 'manage_tutor_instructor', Withdraw_Requests_List::WITHDRAW_REQUEST_LIST_PAGE, array($this, 'withdraw_requests') ); | |
| 74 | + } | |
| 54 | 75 | |
| 55 | - if (defined('TUTOR_PRO_VERSION')) { | |
| 56 | - add_submenu_page( 'tutor', __( 'Add-ons', 'tutor' ), __( 'Add-ons', 'tutor' ), 'manage_tutor', 'tutor-addons', array( $this, 'enable_disable_addons' ) ); | |
| 57 | - } | |
| 76 | + add_submenu_page( 'tutor', __( 'Add-ons', 'tutor' ), __( 'Add-ons', 'tutor' ), 'manage_tutor', 'tutor-addons', array( $this, 'enable_disable_addons' ) ); | |
| 58 | 77 | |
| 59 | - add_submenu_page('tutor', __('Status', 'tutor'), __('Status', 'tutor'), 'manage_tutor', 'tutor-status', array($this, 'tutor_status') ); | |
| 60 | - | |
| 61 | 78 | do_action('tutor_admin_register'); |
| 62 | 79 | |
| 63 | 80 | add_submenu_page('tutor', __('Settings', 'tutor'), __('Settings', 'tutor'), 'manage_tutor', 'tutor_settings', array($this, 'tutor_page') ); |
| 64 | 81 | |
| 65 | - add_submenu_page('tutor',__('Uninstall Tutor LMS', 'tutor'), null, 'deactivate_plugin', 'tutor-uninstall', array($this, 'tutor_uninstall')); | |
| 66 | -/* | |
| 82 | + add_submenu_page('tutor', __('Tools', 'tutor'), __('Tools', 'tutor'), 'manage_tutor', 'tutor-tools', array($this, 'tutor_tools') ); | |
| 83 | + | |
| 67 | 84 | if ( ! $hasPro){ |
| 68 | 85 | add_submenu_page( 'tutor', __( 'Get Pro', 'tutor' ), __( '<span class="dashicons dashicons-awards tutor-get-pro-text"></span> Get Pro', 'tutor' ), 'manage_options', 'tutor-get-pro', array($this, 'tutor_get_pro') ); |
| 69 | - }*/ | |
| 70 | - | |
| 86 | + } | |
| 71 | 87 | } |
| 72 | 88 | |
| 73 | 89 | public function tutor_page(){ |
| 74 | 90 | $tutor_option = new Options(); |
| @@ -82,8 +98,12 @@ | ||
| 82 | 98 | public function tutor_instructors(){ |
| 83 | 99 | include tutor()->path.'views/pages/instructors.php'; |
| 84 | 100 | } |
| 85 | 101 | |
| 102 | + public function tutor_announcements(){ | |
| 103 | + include tutor()->path.'views/pages/announcements.php'; | |
| 104 | + } | |
| 105 | + | |
| 86 | 106 | public function question_answer(){ |
| 87 | 107 | include tutor()->path.'views/pages/question_answer.php'; |
| 88 | 108 | } |
| 89 | 109 | |
| @@ -90,18 +110,49 @@ | ||
| 90 | 110 | public function quiz_attempts(){ |
| 91 | 111 | include tutor()->path.'views/pages/quiz_attempts.php'; |
| 92 | 112 | } |
| 93 | 113 | |
| 114 | + /** | |
| 115 | + * Show the withdraw requests table | |
| 116 | + * | |
| 117 | + * @since v.1.2.0 | |
| 118 | + */ | |
| 119 | + public function withdraw_requests(){ | |
| 120 | + include tutor()->path.'views/pages/withdraw_requests.php'; | |
| 121 | + } | |
| 122 | + | |
| 94 | 123 | public function enable_disable_addons(){ |
| 95 | - include tutor()->path.'views/pages/enable_disable_addons.php'; | |
| 124 | + | |
| 125 | + if (defined('TUTOR_PRO_VERSION')) { | |
| 126 | + include tutor()->path.'views/pages/enable_disable_addons.php'; | |
| 127 | + }else{ | |
| 128 | + include tutor()->path.'views/pages/tutor-pro-addons.php'; | |
| 129 | + } | |
| 96 | 130 | } |
| 97 | 131 | |
| 98 | - public function tutor_status(){ | |
| 99 | - include tutor()->path.'views/pages/status.php'; | |
| 100 | - } | |
| 132 | + public function tutor_tools(){ | |
| 133 | + $tutor_admin_tools_page = tutils()->array_get('tutor_admin_tools_page', $_GET); | |
| 134 | + if ($tutor_admin_tools_page){ | |
| 135 | + include apply_filters('tutor_admin_tools_page', tutor()->path."views/pages/{$tutor_admin_tools_page}.php", $tutor_admin_tools_page); | |
| 136 | + }else{ | |
| 137 | + $pages = apply_filters('tutor_tool_pages', array( | |
| 138 | + 'tutor_pages' => array('title' => __('Tutor Pages', 'tutor') ), | |
| 139 | + 'status' => __('Status', 'tutor'), | |
| 140 | + )); | |
| 101 | 141 | |
| 102 | - public function tutor_uninstall(){ | |
| 103 | - include tutor()->path.'views/pages/uninstall.php'; | |
| 142 | + $current_page = 'tutor_pages'; | |
| 143 | + $requested_page = sanitize_text_field(tutils()->array_get('sub_page', $_GET)); | |
| 144 | + if ($requested_page){ | |
| 145 | + $current_page = $requested_page; | |
| 146 | + } | |
| 147 | + | |
| 148 | + $current_page = str_replace('/', '', $current_page); | |
| 149 | + $current_page = str_replace('.', '', $current_page); | |
| 150 | + $current_page = str_replace('\\', '', $current_page); | |
| 151 | + $current_page = trim($current_page); | |
| 152 | + | |
| 153 | + include tutor()->path.'views/pages/tools.php'; | |
| 154 | + } | |
| 104 | 155 | } |
| 105 | 156 | |
| 106 | 157 | public function tutor_get_pro(){ |
| 107 | 158 | include tutor()->path.'views/pages/get-pro.php'; |
| @@ -135,38 +186,42 @@ | ||
| 135 | 186 | * Filter posts for instructor |
| 136 | 187 | */ |
| 137 | 188 | public function filter_posts_for_instructors(){ |
| 138 | 189 | if ( ! current_user_can('administrator') && current_user_can(tutor()->instructor_role)){ |
| 139 | - remove_menu_page( 'edit-comments.php' ); //Comments | |
| 190 | + @remove_menu_page( 'edit-comments.php' ); //Comments | |
| 140 | 191 | add_filter( 'posts_clauses_request', array($this, 'posts_clauses_request') ); |
| 141 | 192 | } |
| 142 | 193 | } |
| 143 | 194 | |
| 144 | 195 | public function posts_clauses_request($clauses){ |
| 196 | + | |
| 197 | + if(tutor_utils()->has_user_role(array('administrator', 'editor'))) { | |
| 198 | + return $clauses; | |
| 199 | + } | |
| 200 | + | |
| 201 | + // Need multi instructor check | |
| 145 | 202 | global $wpdb; |
| 146 | 203 | |
| 147 | 204 | $user_id = get_current_user_id(); |
| 148 | 205 | |
| 149 | - $get_assigned_courses_ids = $wpdb->get_col("SELECT meta_value from {$wpdb->usermeta} WHERE meta_key = '_tutor_instructor_course_id' AND user_id = {$user_id} "); | |
| 206 | + $get_assigned_courses_ids = $wpdb->get_col($wpdb->prepare("SELECT meta_value from {$wpdb->usermeta} WHERE meta_key = '_tutor_instructor_course_id' AND user_id = %d", $user_id)); | |
| 207 | + $own_courses = is_array($get_assigned_courses_ids) ? $get_assigned_courses_ids : array(); | |
| 208 | + $in_query_pre = implode(',', $own_courses); | |
| 150 | 209 | |
| 151 | - $custom_author_query = "AND {$wpdb->posts}.post_author = {$user_id}"; | |
| 152 | - if (is_array($get_assigned_courses_ids) && count($get_assigned_courses_ids)){ | |
| 153 | - $in_query_pre = implode(',', $get_assigned_courses_ids); | |
| 154 | - $custom_author_query = " AND ( {$wpdb->posts}.post_author = {$user_id} OR {$wpdb->posts}.ID IN({$in_query_pre}) ) "; | |
| 155 | - } | |
| 156 | - | |
| 210 | + $custom_author_query = " AND ({$wpdb->posts}.post_type!='courses' OR {$wpdb->posts}.post_author = {$user_id} OR {$wpdb->posts}.ID IN({$in_query_pre})) "; | |
| 211 | + | |
| 157 | 212 | $clauses['where'] .= $custom_author_query; |
| 158 | - | |
| 213 | + | |
| 159 | 214 | return $clauses; |
| 160 | 215 | } |
| 161 | 216 | |
| 162 | 217 | /** |
| 163 | - * Prevent unauthorised post edit page by direct URL | |
| 218 | + * Prevent unauthorised course/lesson edit page by direct URL | |
| 164 | 219 | * |
| 165 | 220 | * @since v.1.0.0 |
| 166 | 221 | */ |
| 167 | 222 | public function check_if_current_users_post(){ |
| 168 | - if (! current_user_can(tutor()->instructor_role)) { | |
| 223 | + if (current_user_can('administrator') || ! current_user_can(tutor()->instructor_role)) { | |
| 169 | 224 | return; |
| 170 | 225 | } |
| 171 | 226 | |
| 172 | 227 | if (! empty($_GET['post']) ) { |
| @@ -171,14 +226,19 @@ | ||
| 171 | 226 | |
| 172 | 227 | if (! empty($_GET['post']) ) { |
| 173 | 228 | $get_post_id = (int) sanitize_text_field($_GET['post']); |
| 174 | 229 | $get_post = get_post($get_post_id); |
| 230 | + $tutor_post_types = array(tutor()->course_post_type, tutor()->lesson_post_type); | |
| 231 | + | |
| 175 | 232 | $current_user = get_current_user_id(); |
| 176 | 233 | |
| 177 | - if ($get_post->post_author != $current_user){ | |
| 234 | + if (in_array($get_post->post_type, $tutor_post_types) && $get_post->post_author != $current_user){ | |
| 178 | 235 | global $wpdb; |
| 179 | 236 | |
| 180 | - $get_assigned_courses_ids = (int) $wpdb->get_var("SELECT user_id from {$wpdb->usermeta} WHERE user_id = {$current_user} AND meta_key = '_tutor_instructor_course_id' AND meta_value = {$get_post_id} "); | |
| 237 | + $get_assigned_courses_ids = (int) $wpdb->get_var($wpdb->prepare( | |
| 238 | + "SELECT user_id | |
| 239 | + from {$wpdb->usermeta} | |
| 240 | + WHERE user_id = %d AND meta_key = '_tutor_instructor_course_id' AND meta_value = %d ", $current_user, $get_post_id)); | |
| 181 | 241 | |
| 182 | 242 | if ( ! $get_assigned_courses_ids){ |
| 183 | 243 | wp_die(__('Permission Denied', 'tutor')); |
| 184 | 244 | } |
| @@ -195,9 +255,8 @@ | ||
| 195 | 255 | if ( ! $template_path){ |
| 196 | 256 | $template_path = tutor()->path.'templates/'; |
| 197 | 257 | } |
| 198 | 258 | |
| 199 | - | |
| 200 | 259 | $files = @scandir( $template_path ); // @codingStandardsIgnoreLine. |
| 201 | 260 | $result = array(); |
| 202 | 261 | |
| 203 | 262 | if ( ! empty( $files ) ) { |
| @@ -287,9 +346,8 @@ | ||
| 287 | 346 | 'domdocument_enabled' => class_exists( 'DOMDocument' ), |
| 288 | 347 | 'gzip_enabled' => is_callable( 'gzopen' ), |
| 289 | 348 | 'mbstring_enabled' => extension_loaded( 'mbstring' ), |
| 290 | 349 | ); |
| 291 | - | |
| 292 | 350 | } |
| 293 | 351 | |
| 294 | 352 | |
| 295 | 353 | public function erase_tutor_data(){ |
| @@ -295,9 +353,9 @@ | ||
| 295 | 353 | public function erase_tutor_data(){ |
| 296 | 354 | global $wpdb; |
| 297 | 355 | |
| 298 | 356 | $is_erase_data = tutor_utils()->get_option('delete_on_uninstall'); |
| 299 | - /**D*/ //=> Deleting Data | |
| 357 | + //=> Deleting Data | |
| 300 | 358 | |
| 301 | 359 | $plugin_file = tutor()->basename; |
| 302 | 360 | if ($is_erase_data && current_user_can( 'deactivate_plugin', $plugin_file )) { |
| 303 | 361 | /** |
| @@ -309,9 +367,8 @@ | ||
| 309 | 367 | $post_types = array( |
| 310 | 368 | $course_post_type, |
| 311 | 369 | $lesson_post_type, |
| 312 | 370 | 'tutor_quiz', |
| 313 | - 'tutor_question', | |
| 314 | 371 | 'tutor_enrolled', |
| 315 | 372 | 'topics', |
| 316 | 373 | 'tutor_enrolled', |
| 317 | 374 | 'tutor_announcements', |
| @@ -324,20 +381,20 @@ | ||
| 324 | 381 | foreach ($tutor_posts as $post_id){ |
| 325 | 382 | //Delete categories |
| 326 | 383 | $terms = wp_get_object_terms( $post_id, 'course-category' ); |
| 327 | 384 | foreach( $terms as $term ){ |
| 328 | - /**D*/ wp_remove_object_terms( $post_id, array( $term->term_id ), 'course-category' ); | |
| 385 | + wp_remove_object_terms( $post_id, array( $term->term_id ), 'course-category' ); | |
| 329 | 386 | } |
| 330 | - | |
| 387 | + | |
| 331 | 388 | //Delete tags if available |
| 332 | 389 | $terms = wp_get_object_terms( $post_id, 'course-tag' ); |
| 333 | 390 | foreach( $terms as $term ){ |
| 334 | - /**D*/ wp_remove_object_terms( $post_id, array( $term->term_id ), 'course-tag' ); | |
| 391 | + wp_remove_object_terms( $post_id, array( $term->term_id ), 'course-tag' ); | |
| 335 | 392 | } |
| 336 | 393 | |
| 337 | 394 | //Delete All Meta |
| 338 | - /**D*/ $wpdb->delete($wpdb->postmeta, array('post_id' => $post_id) ); | |
| 339 | - /**D*/ $wpdb->delete($wpdb->posts, array('ID' => $post_id) ); | |
| 395 | + $wpdb->delete($wpdb->postmeta, array('post_id' => $post_id) ); | |
| 396 | + $wpdb->delete($wpdb->posts, array('ID' => $post_id) ); | |
| 340 | 397 | } |
| 341 | 398 | } |
| 342 | 399 | |
| 343 | 400 | /** |
| @@ -345,37 +402,41 @@ | ||
| 345 | 402 | */ |
| 346 | 403 | $tutor_comments = $wpdb->get_col("SELECT comment_ID from {$wpdb->comments} WHERE comment_agent = 'comment_agent' ;"); |
| 347 | 404 | $comments_ids_strings = "'".implode("','", $tutor_comments)."'"; |
| 348 | 405 | if (is_array($tutor_comments) && count($tutor_comments)){ |
| 349 | - /**D*/ $wpdb->query("DELETE from {$wpdb->commentmeta} WHERE comment_ID in({$comments_ids_strings}) "); | |
| 406 | + $wpdb->query("DELETE from {$wpdb->commentmeta} WHERE comment_ID in({$comments_ids_strings}) "); | |
| 350 | 407 | } |
| 351 | - /**D*/ $wpdb->delete($wpdb->comments, array('comment_agent' => 'comment_agent')); | |
| 408 | + $wpdb->delete($wpdb->comments, array('comment_agent' => 'comment_agent')); | |
| 352 | 409 | |
| 353 | 410 | /** |
| 354 | 411 | * Delete Options |
| 355 | 412 | */ |
| 356 | 413 | |
| 357 | - /**D*/ delete_option('tutor_option'); | |
| 358 | - /**D*/ $wpdb->delete($wpdb->usermeta, array('meta_key' => '_is_tutor_student')); | |
| 359 | - /**D*/ $wpdb->delete($wpdb->usermeta, array('meta_key' => '_tutor_instructor_approved')); | |
| 360 | - /**D*/ $wpdb->delete($wpdb->usermeta, array('meta_key' => '_tutor_instructor_status')); | |
| 361 | - /**D*/ $wpdb->delete($wpdb->usermeta, array('meta_key' => '_is_tutor_instructor')); | |
| 362 | - /**D*/ $wpdb->query("DELETE FROM {$wpdb->usermeta} WHERE meta_key LIKE '%_tutor_completed_lesson_id_%' "); | |
| 414 | + delete_option('tutor_option'); | |
| 415 | + $wpdb->delete($wpdb->usermeta, array('meta_key' => '_is_tutor_student')); | |
| 416 | + $wpdb->delete($wpdb->usermeta, array('meta_key' => '_tutor_instructor_approved')); | |
| 417 | + $wpdb->delete($wpdb->usermeta, array('meta_key' => '_tutor_instructor_status')); | |
| 418 | + $wpdb->delete($wpdb->usermeta, array('meta_key' => '_is_tutor_instructor')); | |
| 419 | + $wpdb->query("DELETE FROM {$wpdb->usermeta} WHERE meta_key LIKE '%_tutor_completed_lesson_id_%' "); | |
| 363 | 420 | |
| 421 | + //Deleting Table | |
| 422 | + $prefix = $wpdb->prefix; | |
| 423 | + $wpdb->query("DROP TABLE IF EXISTS {$prefix}tutor_quiz_attempts, {$prefix}tutor_quiz_attempt_answers, {$prefix}tutor_quiz_questions, {$prefix}tutor_quiz_question_answers, {$prefix}tutor_earnings, {$prefix}tutor_withdraws "); | |
| 424 | + | |
| 364 | 425 | deactivate_plugins($plugin_file); |
| 365 | 426 | } |
| 366 | - | |
| 427 | + | |
| 367 | 428 | wp_redirect('plugins.php'); |
| 368 | 429 | die(); |
| 369 | 430 | } |
| 370 | 431 | |
| 371 | 432 | public function plugin_action_links($actions){ |
| 372 | - /*$hasPro = tutor()->has_pro; | |
| 433 | + $hasPro = tutor()->has_pro; | |
| 373 | 434 | |
| 374 | 435 | if(!$hasPro){ |
| 375 | 436 | $actions['tutor_pro_link'] = '<a href="https://www.themeum.com/product/tutor-lms/#pricing?utm_source=tutor_plugin_action_link&utm_medium=wordpress_dashboard&utm_campaign=go_premium" target="_blank"><span |
| 376 | - style="color: #39a700eb; font-weight: bold;">'.__('Upgrade to Pro', 'wp-megamenu').'</span></a>'; | |
| 377 | - }*/ | |
| 437 | + style="color: #ff7742; font-weight: bold;">' . __('Upgrade to Pro', 'wp-megamenu') . '</span></a>'; | |
| 438 | + } | |
| 378 | 439 | |
| 379 | 440 | $is_erase_data = tutor_utils()->get_option('delete_on_uninstall'); |
| 380 | 441 | |
| 381 | 442 | if ($is_erase_data) { |
| @@ -381,9 +442,9 @@ | ||
| 381 | 442 | if ($is_erase_data) { |
| 382 | 443 | $plugin_file = tutor()->basename; |
| 383 | 444 | if ( current_user_can( 'deactivate_plugin', $plugin_file ) ) { |
| 384 | 445 | if ( isset( $actions['deactivate'] ) ) { |
| 385 | - $actions['deactivate'] = '<a href="admin.php?page=tutor-uninstall">' . __('Uninstall', 'tutor') . '</a>'; | |
| 446 | + $actions['deactivate'] = '<a href="admin.php?page=tutor-tools&tutor_admin_tools_page=uninstall">' . __('Uninstall', 'tutor') . '</a>'; | |
| 386 | 447 | } |
| 387 | 448 | } |
| 388 | 449 | } |
| 389 | 450 | |
| @@ -390,7 +451,51 @@ | ||
| 390 | 451 | $actions['settings'] = '<a href="admin.php?page=tutor_settings">' . __('Settings', 'tutor') . '</a>'; |
| 391 | 452 | return $actions; |
| 392 | 453 | } |
| 393 | 454 | |
| 455 | + public function plugin_row_meta($plugin_meta, $plugin_file){ | |
| 456 | + | |
| 457 | + if ($plugin_file === tutor()->basename) { | |
| 458 | + $plugin_meta[] = sprintf( '<a href="%s">%s</a>', | |
| 459 | + esc_url( 'https://docs.themeum.com/tutor-lms/?utm_source=tutor&utm_medium=plugins_installation_list&utm_campaign=plugin_docs_link' ), | |
| 460 | + __( '<strong style="color: #03bd24">Documentation</strong>', 'tutor' ) | |
| 461 | + ); | |
| 462 | + $plugin_meta[] = sprintf( '<a href="%s">%s</a>', | |
| 463 | + esc_url( 'https://www.themeum.com/contact-us/?utm_source=tutor&utm_medium=plugins_installation_list&utm_campaign=plugin_support_link' ), | |
| 464 | + __( '<strong style="color: #03bd24">Get Support</strong>', 'tutor' ) | |
| 465 | + ); | |
| 466 | + } | |
| 467 | + | |
| 468 | + return $plugin_meta; | |
| 469 | + } | |
| 470 | + | |
| 471 | + /** | |
| 472 | + * @param $footer_text | |
| 473 | + * | |
| 474 | + * @return string | |
| 475 | + * | |
| 476 | + * Add footer text only on tutor pages | |
| 477 | + */ | |
| 478 | + public function admin_footer_text( $footer_text ) { | |
| 479 | + $current_screen = get_current_screen(); | |
| 480 | + | |
| 481 | + /** | |
| 482 | + * We are making sure that this message will be only on Tutor Admin page | |
| 483 | + */ | |
| 484 | + if ( apply_filters( 'tutor_display_admin_footer_text', (tutor_utils()->array_get('parent_base', $current_screen) === 'tutor' ) ) ) { | |
| 485 | + $footer_text = sprintf( | |
| 486 | + __( 'If you like %1$s please leave us a %2$s rating. A huge thanks in advance!', 'tutor' ), | |
| 487 | + sprintf( '<strong>%s</strong>', esc_html__( 'Tutor LMS', 'tutor' ) ), | |
| 488 | + '<a href="https://wordpress.org/support/plugin/tutor/reviews?rate=5#new-post" target="_blank" class="tutor-rating-link">★★★★★</a>' | |
| 489 | + ); | |
| 490 | + } | |
| 491 | + | |
| 492 | + return $footer_text; | |
| 493 | + } | |
| 494 | + | |
| 495 | + | |
| 496 | + public function register_course_widget(){ | |
| 497 | + register_widget( 'Tutor\Course_Widget' ); | |
| 498 | + } | |
| 394 | 499 | |
| 395 | 500 | |
| 396 | 501 | } |