| @@ -9,10 +9,8 @@ | ||
| 9 | 9 | */ |
| 10 | 10 | |
| 11 | 11 | namespace TUTOR; |
| 12 | 12 | |
| 13 | -defined( 'ABSPATH' ) || exit; | |
| 14 | - | |
| 15 | 13 | use Tutor\Ecommerce\OrderController; |
| 16 | 14 | use Tutor\Helpers\HttpHelper; |
| 17 | 15 | use TUTOR\Input; |
| 18 | 16 | use Tutor\Models\CourseModel; |
| @@ -17,8 +15,12 @@ | ||
| 17 | 15 | use TUTOR\Input; |
| 18 | 16 | use Tutor\Models\CourseModel; |
| 19 | 17 | use Tutor\Traits\JsonResponse; |
| 20 | 18 | |
| 19 | +if ( ! defined( 'ABSPATH' ) ) { | |
| 20 | + exit; | |
| 21 | +} | |
| 22 | + | |
| 21 | 23 | /** |
| 22 | 24 | * Admin Class |
| 23 | 25 | * |
| 24 | 26 | * @since 1.0.0 |
| @@ -29,12 +31,12 @@ | ||
| 29 | 31 | /** |
| 30 | 32 | * Constructor |
| 31 | 33 | * |
| 32 | 34 | * @since 1.0.0 |
| 33 | - * | |
| 34 | 35 | * @return void |
| 35 | 36 | */ |
| 36 | 37 | public function __construct() { |
| 38 | + | |
| 37 | 39 | add_action( 'admin_notices', array( $this, 'show_unstable_version_admin_notice' ) ); |
| 38 | 40 | |
| 39 | 41 | add_action( 'admin_menu', array( $this, 'register_menu' ) ); |
| 40 | 42 | // Force activate menu for necessary. |
| @@ -41,9 +43,8 @@ | ||
| 41 | 43 | add_filter( 'parent_file', array( $this, 'parent_menu_active' ) ); |
| 42 | 44 | add_filter( 'submenu_file', array( $this, 'submenu_file_active' ), 10, 2 ); |
| 43 | 45 | |
| 44 | 46 | add_action( 'admin_init', array( $this, 'filter_posts_for_instructors' ) ); |
| 45 | - add_action( 'admin_init', array( $this, 'redirect_to_welcome_page' ) ); | |
| 46 | 47 | add_action( 'load-post.php', array( $this, 'check_if_current_users_post' ) ); |
| 47 | 48 | |
| 48 | 49 | add_filter( 'plugin_action_links_' . plugin_basename( TUTOR_FILE ), array( $this, 'plugin_action_links' ) ); |
| 49 | 50 | |
| @@ -56,125 +57,16 @@ | ||
| 56 | 57 | add_action( 'widgets_init', array( $this, 'register_course_widget' ) ); |
| 57 | 58 | |
| 58 | 59 | // Handle flash toast message for redirect_to util helper. |
| 59 | 60 | add_action( 'admin_head', array( new Utils(), 'handle_flash_message' ), 999 ); |
| 61 | + // add_action( 'tutor_after_settings_menu', '\TUTOR\WhatsNew::whats_new_menu', 11 ); | |
| 60 | 62 | |
| 61 | 63 | add_action( 'admin_bar_menu', array( $this, 'add_toolbar_items' ), 100 ); |
| 62 | 64 | |
| 63 | 65 | add_action( 'wp_ajax_tutor_do_not_show_feature_page', array( $this, 'handle_do_not_show_feature_page' ) ); |
| 64 | - | |
| 65 | - add_action( 'upgrader_process_complete', array( $this, 'set_permalink_flag_on_upgrade' ), 10, 2 ); | |
| 66 | - | |
| 67 | - add_action( 'admin_notices', array( $this, 'show_offer_notice' ) ); | |
| 68 | - add_action( 'wp_ajax_tutor_dismiss_offer_notice', array( $this, 'ajax_dismiss_offer_notice' ) ); | |
| 69 | 66 | } |
| 70 | 67 | |
| 71 | 68 | /** |
| 72 | - * Flush Tutor permalink rewrite rules after updates. | |
| 73 | - * | |
| 74 | - * @since 4.0.0 | |
| 75 | - * | |
| 76 | - * @param mixed $upgrader_object Upgrader instance. | |
| 77 | - * @param array $options Extra arguments passed to the hook. | |
| 78 | - * | |
| 79 | - * @return void | |
| 80 | - */ | |
| 81 | - public function set_permalink_flag_on_upgrade( $upgrader_object, $options ) { | |
| 82 | - Permalink::set_permalink_reset_flag( $upgrader_object, $options ); | |
| 83 | - } | |
| 84 | - | |
| 85 | - /** | |
| 86 | - * Check offer notice is dismissed. | |
| 87 | - * | |
| 88 | - * @since 4.0.0 | |
| 89 | - * | |
| 90 | - * @return bool | |
| 91 | - */ | |
| 92 | - private function is_offer_notice_dismissed() { | |
| 93 | - return '4.0.0' === get_transient( 'tutor_offer_notice_dismissed' ); | |
| 94 | - } | |
| 95 | - | |
| 96 | - /** | |
| 97 | - * Show offer notice | |
| 98 | - * | |
| 99 | - * @since 4.0.0 | |
| 100 | - * | |
| 101 | - * @return void | |
| 102 | - */ | |
| 103 | - public function show_offer_notice() { | |
| 104 | - if ( ! User::is_admin() || Input::has( 'welcome', Input::GET_REQUEST ) ) { | |
| 105 | - return; | |
| 106 | - } | |
| 107 | - | |
| 108 | - $is_free_user = ! tutor()->has_pro; | |
| 109 | - $cta_label = __( 'Claim 30% OFF', 'tutor' ); | |
| 110 | - $cta_link = 'https://tutorlms.com/pricing/?utm_source=tutor-plugin&utm_medium=notice&utm_campaign=tutor-lms-pro-offer'; | |
| 111 | - | |
| 112 | - $now = new \DateTimeImmutable( 'now', wp_timezone() ); | |
| 113 | - $expiration_dt = '2026-07-15 23:59:59'; | |
| 114 | - $expiration = new \DateTimeImmutable( $expiration_dt, wp_timezone() ); | |
| 115 | - | |
| 116 | - $remaining = max( 0, $expiration->getTimestamp() - $now->getTimestamp() ); | |
| 117 | - | |
| 118 | - $days = floor( $remaining / DAY_IN_SECONDS ); | |
| 119 | - $hours = floor( ( $remaining % DAY_IN_SECONDS ) / HOUR_IN_SECONDS ); | |
| 120 | - $minutes = floor( ( $remaining % HOUR_IN_SECONDS ) / MINUTE_IN_SECONDS ); | |
| 121 | - $seconds = $remaining % MINUTE_IN_SECONDS; | |
| 122 | - | |
| 123 | - $expire_in = sprintf( | |
| 124 | - '%dd:%02dh:%02d:%02d', | |
| 125 | - $days, | |
| 126 | - $hours, | |
| 127 | - $minutes, | |
| 128 | - $seconds | |
| 129 | - ); | |
| 130 | - | |
| 131 | - if ( $is_free_user && $remaining > 0 && ! self::is_offer_notice_dismissed() ) { | |
| 132 | - ?> | |
| 133 | - <div class="tutor-offer-notice"> | |
| 134 | - <div class="tutor-offer-notice-wrapper"> | |
| 135 | - <div class="tutor-offer-notice-left"> | |
| 136 | - <div data-subheader><?php esc_html_e( '4.0 launch offer', 'tutor' ); ?></div> | |
| 137 | - <div data-header><?php esc_html_e( '30% OFF', 'tutor' ); ?></div> | |
| 138 | - <div data-subtext><?php esc_html_e( 'on all annual plans', 'tutor' ); ?></div> | |
| 139 | - </div> | |
| 140 | - <div class="tutor-offer-notice-right"> | |
| 141 | - <div class="tutor-offer-notice-text"><?php esc_html_e( 'Offer ends by', 'tutor' ); ?> <span class="tutor-offer-notice-timer" data-expiry="<?php echo esc_attr( $expiration->getTimestamp() ); ?>"><?php echo esc_html( $expire_in ); ?></span></div> | |
| 142 | - <a class="tutor-offer-notice-cta" href="<?php echo esc_url( $cta_link ); ?>" target="_blank"> | |
| 143 | - <?php echo esc_html( $cta_label ); ?> | |
| 144 | - <svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" fill="none" viewBox="0 0 24 24"><path fill="#fff" d="M13.938 6.937a.55.55 0 0 0-.786 0 .555.555 0 0 0 0 .778l3.338 3.34H5.243a.55.55 0 0 0-.55.551c0 .305.242.558.55.558h11.246l-3.337 3.334a.563.563 0 0 0 0 .785.55.55 0 0 0 .786 0L18.217 12a.543.543 0 0 0 0-.78z"/></svg> | |
| 145 | - </a> | |
| 146 | - </div> | |
| 147 | - </div> | |
| 148 | - <button type="button" class="tutor-offer-notice-dismiss"><span class="tutor-icon-times"></span></button> | |
| 149 | - </div> | |
| 150 | - <?php | |
| 151 | - } | |
| 152 | - } | |
| 153 | - | |
| 154 | - /** | |
| 155 | - * Dismiss offer notice. | |
| 156 | - * | |
| 157 | - * @since 4.0.0 | |
| 158 | - * | |
| 159 | - * @return void JSON response. | |
| 160 | - */ | |
| 161 | - public function ajax_dismiss_offer_notice() { | |
| 162 | - if ( ! User::is_admin() ) { | |
| 163 | - $this->response_bad_request( tutor_utils()->error_message() ); | |
| 164 | - } | |
| 165 | - | |
| 166 | - if ( self::is_offer_notice_dismissed() ) { | |
| 167 | - $this->response_bad_request( __( 'You have already dismissed the offer notice.', 'tutor' ) ); | |
| 168 | - } | |
| 169 | - | |
| 170 | - // Set expiry until next day. | |
| 171 | - $expiration = strtotime( 'tomorrow' ) - time(); | |
| 172 | - set_transient( 'tutor_offer_notice_dismissed', '4.0.0', $expiration ); | |
| 173 | - $this->json_response( __( 'Notice dismissed', 'tutor' ) ); | |
| 174 | - } | |
| 175 | - | |
| 176 | - /** | |
| 177 | 69 | * Show unstable version notice. |
| 178 | 70 | * |
| 179 | 71 | * @since 3.0.0 |
| 180 | 72 | * |
| @@ -197,10 +89,8 @@ | ||
| 197 | 89 | /** |
| 198 | 90 | * Register admin menus |
| 199 | 91 | * |
| 200 | 92 | * @since 1.0.0 |
| 201 | - * @since 3.8.0 re-organize admin menu. | |
| 202 | - * | |
| 203 | 93 | * @return void |
| 204 | 94 | */ |
| 205 | 95 | public function register_menu() { |
| 206 | 96 | $has_pro = tutor()->has_pro; |
| @@ -239,182 +129,68 @@ | ||
| 239 | 129 | $icon_base64_uri, |
| 240 | 130 | $menu_position |
| 241 | 131 | ); |
| 242 | 132 | |
| 243 | - new WhatsNew(); | |
| 133 | + // Added @since v2.0.0. | |
| 134 | + add_submenu_page( 'tutor', __( 'Courses', 'tutor' ), __( 'Courses', 'tutor' ), 'manage_tutor_instructor', 'tutor', array( $this, 'tutor_course_list' ) ); | |
| 244 | 135 | |
| 245 | - $admin_menu = apply_filters( | |
| 246 | - 'tutor_admin_menu', | |
| 247 | - array( | |
| 248 | - 'group_one' => array( | |
| 249 | - 'courses' => array( | |
| 250 | - 'parent_slug' => 'tutor', | |
| 251 | - 'page_title' => __( 'Courses', 'tutor' ), | |
| 252 | - 'menu_title' => __( 'Courses', 'tutor' ), | |
| 253 | - 'capability' => 'manage_tutor_instructor', | |
| 254 | - 'menu_slug' => 'tutor', | |
| 255 | - 'callback' => array( $this, 'tutor_course_list' ), | |
| 256 | - ), | |
| 257 | - 'content_bank' => null, | |
| 258 | - 'course_builder' => array( | |
| 259 | - 'parent_slug' => 'tutor', | |
| 260 | - 'page_title' => __( 'Course Builder', 'tutor' ), | |
| 261 | - 'menu_title' => '<span class="tutor-create-course">Create Course</span>', | |
| 262 | - 'capability' => 'manage_tutor_instructor', | |
| 263 | - 'menu_slug' => 'create-course', | |
| 264 | - 'callback' => array( new Course( false ), 'load_course_builder' ), | |
| 265 | - ), | |
| 266 | - 'categories' => array( | |
| 267 | - 'parent_slug' => 'tutor', | |
| 268 | - 'page_title' => __( 'Categories', 'tutor' ), | |
| 269 | - 'menu_title' => __( 'Categories', 'tutor' ), | |
| 270 | - 'capability' => 'manage_tutor', | |
| 271 | - 'menu_slug' => 'edit-tags.php?taxonomy=course-category&post_type=' . $course_post_type, | |
| 272 | - ), | |
| 273 | - 'tags' => array( | |
| 274 | - 'parent_slug' => 'tutor', | |
| 275 | - 'page_title' => __( 'Tags', 'tutor' ), | |
| 276 | - 'menu_title' => __( 'Tags', 'tutor' ), | |
| 277 | - 'capability' => 'manage_tutor', | |
| 278 | - 'menu_slug' => 'edit-tags.php?taxonomy=course-tag&post_type=' . $course_post_type, | |
| 279 | - ), | |
| 280 | - ), | |
| 281 | - 'group_two' => array( | |
| 282 | - 'orders' => null, | |
| 283 | - 'subscriptions' => null, | |
| 284 | - 'coupons' => null, | |
| 285 | - 'students' => array( | |
| 286 | - 'parent_slug' => 'tutor', | |
| 287 | - 'page_title' => __( 'Students', 'tutor' ), | |
| 288 | - 'menu_title' => __( 'Students', 'tutor' ), | |
| 289 | - 'capability' => 'manage_tutor', | |
| 290 | - 'menu_slug' => Students_List::STUDENTS_LIST_PAGE, | |
| 291 | - 'callback' => array( $this, 'tutor_students' ), | |
| 136 | + if ( '3.0.0' !== get_option( 'tutor-new-feature' ) ) { | |
| 137 | + add_submenu_page( 'tutor', __( 'What\'s New', 'tutor' ), sprintf( '<span class="tutor-new-feature tutor-text-orange">%s</span>', __( 'What\'s New', 'tutor' ) ), 'manage_tutor', 'tutor-new-feature', array( $this, 'feature_promotion_page' ) ); | |
| 138 | + } | |
| 292 | 139 | |
| 293 | - ), | |
| 294 | - 'announcements' => array( | |
| 295 | - 'parent_slug' => 'tutor', | |
| 296 | - 'page_title' => __( 'Announcements', 'tutor' ), | |
| 297 | - 'menu_title' => __( 'Announcements', 'tutor' ), | |
| 298 | - 'capability' => 'manage_tutor_instructor', | |
| 299 | - 'menu_slug' => 'tutor_announcements', | |
| 300 | - 'callback' => array( $this, 'tutor_announcements' ), | |
| 140 | + // Ecommerce menu @since 3.0.0. | |
| 141 | + do_action( 'tutor_after_courses_admin_menu' ); | |
| 301 | 142 | |
| 302 | - ), | |
| 303 | - 'assignments' => null, | |
| 304 | - 'quiz_attempts' => array( | |
| 305 | - 'parent_slug' => 'tutor', | |
| 306 | - 'page_title' => __( 'Quiz Attempts', 'tutor' ), | |
| 307 | - 'menu_title' => __( 'Quiz Attempts', 'tutor' ), | |
| 308 | - 'capability' => 'manage_tutor_instructor', | |
| 309 | - 'menu_slug' => Quiz_Attempts_List::QUIZ_ATTEMPT_PAGE, | |
| 310 | - 'callback' => array( $this, 'quiz_attempts' ), | |
| 311 | - ), | |
| 312 | - 'q_and_a' => array( | |
| 313 | - 'parent_slug' => 'tutor', | |
| 314 | - 'page_title' => __( 'Q&A', 'tutor' ), | |
| 315 | - 'menu_title' => __( 'Q&A ', 'tutor' ) . $unanswered_bubble, | |
| 316 | - 'capability' => 'manage_tutor_instructor', | |
| 317 | - 'menu_slug' => Question_Answers_List::QUESTION_ANSWER_PAGE, | |
| 318 | - 'callback' => array( $this, 'question_answer' ), | |
| 319 | - ), | |
| 320 | - 'enrollments' => null, | |
| 321 | - 'reports' => null, | |
| 322 | - 'gradebook' => null, | |
| 323 | - 'instructors' => $enable_course_marketplace ? array( | |
| 324 | - 'parent_slug' => 'tutor', | |
| 325 | - 'page_title' => __( 'Instructors', 'tutor' ), | |
| 326 | - 'menu_title' => __( 'Instructors', 'tutor' ), | |
| 327 | - 'capability' => 'manage_tutor', | |
| 328 | - 'menu_slug' => Instructors_List::INSTRUCTOR_LIST_PAGE, | |
| 329 | - 'callback' => array( $this, 'tutor_instructors' ), | |
| 330 | - ) : null, | |
| 331 | - 'withdraw_requests' => $enable_course_marketplace ? array( | |
| 332 | - 'parent_slug' => 'tutor', | |
| 333 | - 'page_title' => __( 'Withdraw Requests', 'tutor' ), | |
| 334 | - 'menu_title' => __( 'Withdraw Requests', 'tutor' ), | |
| 335 | - 'capability' => 'manage_tutor', | |
| 336 | - 'menu_slug' => Withdraw_Requests_List::WITHDRAW_REQUEST_LIST_PAGE, | |
| 337 | - 'callback' => array( $this, 'withdraw_requests' ), | |
| 338 | - ) : null, | |
| 339 | - ), | |
| 340 | - 'group_three' => array( | |
| 341 | - 'google_classroom' => null, | |
| 342 | - 'zoom' => null, | |
| 343 | - 'google_meet' => null, | |
| 344 | - 'h5p' => null, | |
| 345 | - 'addons' => array( | |
| 346 | - 'parent_slug' => 'tutor', | |
| 347 | - 'page_title' => __( 'Addons', 'tutor' ), | |
| 348 | - 'menu_title' => __( 'Addons', 'tutor' ), | |
| 349 | - 'capability' => 'manage_tutor', | |
| 350 | - 'menu_slug' => 'tutor-addons', | |
| 351 | - 'callback' => array( $this, 'enable_disable_addons' ), | |
| 352 | - ), | |
| 353 | - 'tools' => array( | |
| 354 | - 'parent_slug' => 'tutor', | |
| 355 | - 'page_title' => __( 'Tools', 'tutor' ), | |
| 356 | - 'menu_title' => __( 'Tools', 'tutor' ), | |
| 357 | - 'capability' => 'manage_tutor', | |
| 358 | - 'menu_slug' => 'tutor-tools', | |
| 359 | - 'callback' => array( new Tools_V2(), 'load_tools_page' ), | |
| 360 | - ), | |
| 361 | - 'settings' => array( | |
| 362 | - 'parent_slug' => 'tutor', | |
| 363 | - 'page_title' => __( 'Settings', 'tutor' ), | |
| 364 | - 'menu_title' => __( 'Settings', 'tutor' ), | |
| 365 | - 'capability' => 'manage_tutor', | |
| 366 | - 'menu_slug' => 'tutor_settings', | |
| 367 | - 'callback' => array( new Options_V2(), 'load_settings_page' ), | |
| 368 | - ), | |
| 369 | - 'license' => null, | |
| 370 | - 'whats_new' => null, | |
| 371 | - 'upgrade_to_pro' => $has_pro ? null : array( | |
| 372 | - 'parent_slug' => 'tutor', | |
| 373 | - 'page_title' => __( 'Upgrade to Pro', 'tutor' ), | |
| 374 | - 'menu_title' => sprintf( '<span class="tutor-get-pro-text">%s</span>', __( 'Upgrade to Pro', 'tutor' ) ), | |
| 375 | - 'capability' => 'manage_options', | |
| 376 | - 'menu_slug' => 'tutor-get-pro', | |
| 377 | - 'callback' => array( $this, 'tutor_get_pro' ), | |
| 378 | - ), | |
| 379 | - ), | |
| 380 | - ) | |
| 381 | - ); | |
| 143 | + add_submenu_page( 'tutor', __( 'Course Builder', 'tutor' ), '<span class="tutor-create-course">Create Course</span>', 'manage_tutor_instructor', 'create-course', array( new Course( false ), 'load_course_builder' ) ); | |
| 382 | 144 | |
| 383 | - foreach ( $admin_menu as $group => $menu ) { | |
| 384 | - foreach ( $menu as $name => $args ) { | |
| 385 | - if ( empty( $args ) ) { | |
| 386 | - continue; | |
| 387 | - } | |
| 145 | + // Extendable action hook @since 2.2.0. | |
| 146 | + do_action( 'tutor_after_courses_menu' ); | |
| 388 | 147 | |
| 389 | - // Backward compatibility hook. | |
| 390 | - if ( 'addons' === $name ) { | |
| 391 | - do_action( 'tutor_admin_register' ); | |
| 392 | - } | |
| 148 | + // Templates menu @since 3.6.0. | |
| 149 | + add_submenu_page( 'tutor', __( 'Themes', 'tutor' ), __( 'Themes', 'tutor' ) . sprintf( ' <span class="tutor-theme-menu-badge">%s</span>', __( 'New', 'tutor' ) ), 'manage_tutor', 'tutor-themes', array( $this, 'tutor_themes' ) ); | |
| 393 | 150 | |
| 394 | - // Backward compatibility hook. | |
| 395 | - do_action( "tutor_before_{$name}_admin_menu" ); | |
| 151 | + add_submenu_page( 'tutor', __( 'Categories', 'tutor' ), __( 'Categories', 'tutor' ), 'manage_tutor', 'edit-tags.php?taxonomy=course-category&post_type=' . $course_post_type, null ); | |
| 396 | 152 | |
| 397 | - do_action( "tutor_before_{$name}_menu" ); | |
| 398 | - add_submenu_page( $args['parent_slug'], $args['page_title'], $args['menu_title'], $args['capability'], $args['menu_slug'], $args['callback'] ?? '', $args['position'] ?? null ); | |
| 153 | + add_submenu_page( 'tutor', __( 'Tags', 'tutor' ), __( 'Tags', 'tutor' ), 'manage_tutor', 'edit-tags.php?taxonomy=course-tag&post_type=' . $course_post_type, null ); | |
| 399 | 154 | |
| 400 | - // Backward compatibility hook. | |
| 401 | - do_action( "tutor_after_{$name}_menu" ); | |
| 155 | + add_submenu_page( 'tutor', __( 'Students', 'tutor' ), __( 'Students', 'tutor' ), 'manage_tutor', Students_List::STUDENTS_LIST_PAGE, array( $this, 'tutor_students' ) ); | |
| 402 | 156 | |
| 403 | - do_action( "tutor_after_{$name}_admin_menu" ); | |
| 404 | - } | |
| 157 | + if ( $enable_course_marketplace ) { | |
| 158 | + add_submenu_page( 'tutor', __( 'Instructors', 'tutor' ), __( 'Instructors', 'tutor' ), 'manage_tutor', Instructors_List::INSTRUCTOR_LIST_PAGE, array( $this, 'tutor_instructors' ) ); | |
| 159 | + add_submenu_page( 'tutor', __( 'Withdraw Requests', 'tutor' ), __( 'Withdraw Requests', 'tutor' ), 'manage_tutor', Withdraw_Requests_List::WITHDRAW_REQUEST_LIST_PAGE, array( $this, 'withdraw_requests' ) ); | |
| 160 | + } | |
| 405 | 161 | |
| 406 | - if ( 'group_three' !== $group ) { | |
| 407 | - if ( 'group_two' === $group && ! current_user_can( 'manage_options' ) ) { | |
| 408 | - continue; | |
| 409 | - } | |
| 162 | + add_submenu_page( 'tutor', __( 'Announcements', 'tutor' ), __( 'Announcements', 'tutor' ), 'manage_tutor_instructor', 'tutor_announcements', array( $this, 'tutor_announcements' ) ); | |
| 410 | 163 | |
| 411 | - add_submenu_page( 'tutor', '', '<span class="tutor-admin-menu-separator"></span>', 'manage_tutor_instructor', '#' ); | |
| 412 | - } | |
| 164 | + add_submenu_page( 'tutor', __( 'Q&A', 'tutor' ), __( 'Q&A ', 'tutor' ) . $unanswered_bubble, 'manage_tutor_instructor', Question_Answers_List::QUESTION_ANSWER_PAGE, array( $this, 'question_answer' ) ); | |
| 165 | + | |
| 166 | + add_submenu_page( 'tutor', __( 'Quiz Attempts', 'tutor' ), __( 'Quiz Attempts', 'tutor' ), 'manage_tutor_instructor', Quiz_Attempts_List::QUIZ_ATTEMPT_PAGE, array( $this, 'quiz_attempts' ) ); | |
| 167 | + | |
| 168 | + add_submenu_page( 'tutor', __( 'Addons', 'tutor' ), __( 'Addons', 'tutor' ), 'manage_tutor', 'tutor-addons', array( $this, 'enable_disable_addons' ) ); | |
| 169 | + | |
| 170 | + do_action( 'tutor_admin_register' ); | |
| 171 | + | |
| 172 | + add_submenu_page( 'tutor', __( 'Tools', 'tutor' ), __( 'Tools', 'tutor' ), 'manage_tutor', 'tutor-tools', array( new \TUTOR\Tools_V2(), 'load_tools_page' ) ); | |
| 173 | + | |
| 174 | + add_submenu_page( 'tutor', __( 'Settings', 'tutor' ), __( 'Settings', 'tutor' ), 'manage_tutor', 'tutor_settings', array( new \TUTOR\Options_V2(), 'load_settings_page' ) ); | |
| 175 | + | |
| 176 | + do_action( 'tutor_after_settings_menu' ); | |
| 177 | + | |
| 178 | + if ( ! $has_pro ) { | |
| 179 | + add_submenu_page( 'tutor', __( 'Upgrade to Pro', 'tutor' ), sprintf( '<span class="tutor-get-pro-text">%s</span>', __( 'Upgrade to Pro', 'tutor' ) ), 'manage_options', 'tutor-get-pro', array( $this, 'tutor_get_pro' ) ); | |
| 413 | 180 | } |
| 414 | 181 | } |
| 415 | 182 | |
| 416 | 183 | /** |
| 184 | + * Tutor template view | |
| 185 | + * | |
| 186 | + * @since 3.6.0 | |
| 187 | + */ | |
| 188 | + public function tutor_themes() { | |
| 189 | + include tutor()->path . 'views/template-import/templates.php'; | |
| 190 | + } | |
| 191 | + | |
| 192 | + /** | |
| 417 | 193 | * Welcome page opt-out |
| 418 | 194 | * |
| 419 | 195 | * @since 3.0.0 |
| 420 | 196 | */ |
| @@ -441,8 +217,9 @@ | ||
| 441 | 217 | * @return void |
| 442 | 218 | */ |
| 443 | 219 | public function feature_promotion_page() { |
| 444 | 220 | include tutor()->path . 'views/pages/welcome.php'; |
| 221 | + // include tutor()->path . 'views/pages/feature-promotion.php'; | |
| 445 | 222 | } |
| 446 | 223 | |
| 447 | 224 | /** |
| 448 | 225 | * Show students page |
| @@ -447,9 +224,8 @@ | ||
| 447 | 224 | /** |
| 448 | 225 | * Show students page |
| 449 | 226 | * |
| 450 | 227 | * @since 1.0.0 |
| 451 | - * | |
| 452 | 228 | * @return void |
| 453 | 229 | */ |
| 454 | 230 | public function tutor_students() { |
| 455 | 231 | include tutor()->path . 'views/pages/students.php'; |
| @@ -458,9 +234,8 @@ | ||
| 458 | 234 | /** |
| 459 | 235 | * Show instructor page |
| 460 | 236 | * |
| 461 | 237 | * @since 1.0.0 |
| 462 | - * | |
| 463 | 238 | * @return void |
| 464 | 239 | */ |
| 465 | 240 | public function tutor_instructors() { |
| 466 | 241 | include tutor()->path . 'views/pages/instructors.php'; |
| @@ -469,9 +244,8 @@ | ||
| 469 | 244 | /** |
| 470 | 245 | * Show announcements page |
| 471 | 246 | * |
| 472 | 247 | * @since 1.0.0 |
| 473 | - * | |
| 474 | 248 | * @return void |
| 475 | 249 | */ |
| 476 | 250 | public function tutor_announcements() { |
| 477 | 251 | include tutor()->path . 'views/pages/announcements.php'; |
| @@ -480,9 +254,8 @@ | ||
| 480 | 254 | /** |
| 481 | 255 | * Show Q&A page |
| 482 | 256 | * |
| 483 | 257 | * @since 1.0.0 |
| 484 | - * | |
| 485 | 258 | * @return void |
| 486 | 259 | */ |
| 487 | 260 | public function question_answer() { |
| 488 | 261 | include tutor()->path . 'views/pages/question_answer.php'; |
| @@ -491,9 +264,8 @@ | ||
| 491 | 264 | /** |
| 492 | 265 | * Show quiz attempts page |
| 493 | 266 | * |
| 494 | 267 | * @since 1.0.0 |
| 495 | - * | |
| 496 | 268 | * @return void |
| 497 | 269 | */ |
| 498 | 270 | public function quiz_attempts() { |
| 499 | 271 | include tutor()->path . 'views/pages/quiz_attempts.php'; |
| @@ -502,9 +274,8 @@ | ||
| 502 | 274 | /** |
| 503 | 275 | * Show the withdraw requests table |
| 504 | 276 | * |
| 505 | 277 | * @since 1.2.0 |
| 506 | - * | |
| 507 | 278 | * @return void |
| 508 | 279 | */ |
| 509 | 280 | public function withdraw_requests() { |
| 510 | 281 | include tutor()->path . 'views/pages/withdraw_requests.php'; |
| @@ -513,9 +284,8 @@ | ||
| 513 | 284 | /** |
| 514 | 285 | * Enable or disable addons |
| 515 | 286 | * |
| 516 | 287 | * @since 1.0.0 |
| 517 | - * | |
| 518 | 288 | * @return void |
| 519 | 289 | */ |
| 520 | 290 | public function enable_disable_addons() { |
| 521 | 291 | include tutor()->path . 'views/pages/enable_disable_addons.php'; |
| @@ -524,9 +294,8 @@ | ||
| 524 | 294 | /** |
| 525 | 295 | * Tutor tools page (OLD) |
| 526 | 296 | * |
| 527 | 297 | * @since 1.0.0 |
| 528 | - * | |
| 529 | 298 | * @return void |
| 530 | 299 | */ |
| 531 | 300 | public function tutor_tools_old() { |
| 532 | 301 | $tutor_admin_tools_page = Input::get( 'tutor_admin_tools_page' ); |
| @@ -559,9 +328,8 @@ | ||
| 559 | 328 | /** |
| 560 | 329 | * Show pro upgrade page |
| 561 | 330 | * |
| 562 | 331 | * @since 1.0.0 |
| 563 | - * | |
| 564 | 332 | * @return void |
| 565 | 333 | */ |
| 566 | 334 | public function tutor_get_pro() { |
| 567 | 335 | include tutor()->path . 'views/pages/get-pro.php'; |
| @@ -572,9 +340,8 @@ | ||
| 572 | 340 | * |
| 573 | 341 | * @since 1.0.0 |
| 574 | 342 | * |
| 575 | 343 | * @param string $parent_file parent file. |
| 576 | - * | |
| 577 | 344 | * @return string |
| 578 | 345 | */ |
| 579 | 346 | public function parent_menu_active( $parent_file ) { |
| 580 | 347 | $taxonomy = Input::get( 'taxonomy' ); |
| @@ -612,9 +379,8 @@ | ||
| 612 | 379 | /** |
| 613 | 380 | * Filter posts for instructor |
| 614 | 381 | * |
| 615 | 382 | * @since 1.0.0 |
| 616 | - * | |
| 617 | 383 | * @return void |
| 618 | 384 | */ |
| 619 | 385 | public function filter_posts_for_instructors() { |
| 620 | 386 | if ( ! current_user_can( 'administrator' ) && current_user_can( tutor()->instructor_role ) ) { |
| @@ -628,9 +394,8 @@ | ||
| 628 | 394 | * |
| 629 | 395 | * @since 1.0.0 |
| 630 | 396 | * |
| 631 | 397 | * @param mixed $clauses clauses. |
| 632 | - * | |
| 633 | 398 | * @return mixed |
| 634 | 399 | */ |
| 635 | 400 | public function posts_clauses_request( $clauses ) { |
| 636 | 401 | |
| @@ -660,9 +425,8 @@ | ||
| 660 | 425 | /** |
| 661 | 426 | * Prevent unauthorised course/lesson edit page by direct URL |
| 662 | 427 | * |
| 663 | 428 | * @since 1.0.0 |
| 664 | - * | |
| 665 | 429 | * @return void |
| 666 | 430 | */ |
| 667 | 431 | public function check_if_current_users_post() { |
| 668 | 432 | if ( current_user_can( 'administrator' ) || ! current_user_can( tutor()->instructor_role ) ) { |
| @@ -701,9 +465,8 @@ | ||
| 701 | 465 | * |
| 702 | 466 | * @since 1.0.0 |
| 703 | 467 | * |
| 704 | 468 | * @param string $template_path template file path. |
| 705 | - * | |
| 706 | 469 | * @return array |
| 707 | 470 | */ |
| 708 | 471 | public static function scan_template_files( $template_path = null ) { |
| 709 | 472 | if ( ! $template_path ) { |
| @@ -733,9 +496,8 @@ | ||
| 733 | 496 | /** |
| 734 | 497 | * Get Template overridden files |
| 735 | 498 | * |
| 736 | 499 | * @since 1.0.0 |
| 737 | - * | |
| 738 | 500 | * @return array |
| 739 | 501 | */ |
| 740 | 502 | public static function template_overridden_files() { |
| 741 | 503 | $template_files = self::scan_template_files(); |
| @@ -762,9 +524,8 @@ | ||
| 762 | 524 | * |
| 763 | 525 | * @since 1.0.0 |
| 764 | 526 | * |
| 765 | 527 | * @param array $actions action list. |
| 766 | - * | |
| 767 | 528 | * @return array |
| 768 | 529 | */ |
| 769 | 530 | public function plugin_action_links( $actions ) { |
| 770 | 531 | $has_pro = tutor()->has_pro; |
| @@ -797,14 +558,14 @@ | ||
| 797 | 558 | |
| 798 | 559 | if ( tutor()->basename === $plugin_file ) { |
| 799 | 560 | $plugin_meta[] = sprintf( |
| 800 | 561 | '<a href="%s"><strong style="color: #03bd24">%s</strong></a>', |
| 801 | - esc_url( 'https://tutorlms.com/docs/?utm_source=tutor&utm_medium=plugins_installation_list&utm_campaign=plugin_docs_link' ), | |
| 562 | + esc_url( 'https://docs.themeum.com/tutor-lms/?utm_source=tutor&utm_medium=plugins_installation_list&utm_campaign=plugin_docs_link' ), | |
| 802 | 563 | esc_html__( 'Documentation', 'tutor' ) |
| 803 | 564 | ); |
| 804 | 565 | $plugin_meta[] = sprintf( |
| 805 | 566 | '<a href="%s"><strong style="color: #03bd24">%s</strong></a>', |
| 806 | - esc_url( 'https://tutorlms.com/support/?utm_source=tutor&utm_medium=plugins_installation_list&utm_campaign=plugin_support_link' ), | |
| 567 | + esc_url( 'https://www.themeum.com/contact-us/?utm_source=tutor&utm_medium=plugins_installation_list&utm_campaign=plugin_support_link' ), | |
| 807 | 568 | esc_html__( 'Get Support', 'tutor' ) |
| 808 | 569 | ); |
| 809 | 570 | } |
| 810 | 571 | |
| @@ -816,9 +577,8 @@ | ||
| 816 | 577 | * |
| 817 | 578 | * @since 1.0.0 |
| 818 | 579 | * |
| 819 | 580 | * @param string $footer_text footer text. |
| 820 | - * | |
| 821 | 581 | * @return string |
| 822 | 582 | */ |
| 823 | 583 | public function admin_footer_text( $footer_text ) { |
| 824 | 584 | $current_screen = get_current_screen(); |
| @@ -851,9 +611,8 @@ | ||
| 851 | 611 | /** |
| 852 | 612 | * Tutor Course List |
| 853 | 613 | * |
| 854 | 614 | * @since 2.0.0 |
| 855 | - * | |
| 856 | 615 | * @return void |
| 857 | 616 | */ |
| 858 | 617 | public function tutor_course_list() { |
| 859 | 618 | include tutor()->path . 'views/pages/course-list.php'; |
| @@ -907,9 +666,8 @@ | ||
| 907 | 666 | /** |
| 908 | 667 | * Show welcome page |
| 909 | 668 | * |
| 910 | 669 | * @since 1.0.0 |
| 911 | - * | |
| 912 | 670 | * @return void |
| 913 | 671 | */ |
| 914 | 672 | public function welcome_page() { |
| 915 | 673 | Tutor_Setup::mark_as_visited(); |
| @@ -961,28 +719,6 @@ | ||
| 961 | 719 | ); |
| 962 | 720 | } |
| 963 | 721 | |
| 964 | 722 | return $admin_bar; |
| 965 | - } | |
| 966 | - | |
| 967 | - /** | |
| 968 | - * Redirect to welcome page if user is not logged in. | |
| 969 | - * | |
| 970 | - * @since 4.0.0 | |
| 971 | - * | |
| 972 | - * @return void | |
| 973 | - */ | |
| 974 | - public function redirect_to_welcome_page() { | |
| 975 | - // Skip for fresh installs, during the setup wizard, or during AJAX. | |
| 976 | - if ( ! get_option( 'tutor_wizard' ) || 'tutor-setup' === Input::get( 'page' ) || wp_doing_ajax() ) { | |
| 977 | - return; | |
| 978 | - } | |
| 979 | - | |
| 980 | - $tutor_new_feature = get_option( 'tutor-new-feature' ); | |
| 981 | - if ( version_compare( $tutor_new_feature, '4.0.0-rc.2', '>=' ) ) { | |
| 982 | - return; | |
| 983 | - } | |
| 984 | - | |
| 985 | - wp_safe_redirect( admin_url( 'admin.php?page=tutor&welcome=1' ) ); | |
| 986 | - update_option( 'tutor-new-feature', TUTOR_VERSION ); | |
| 987 | 723 | } |
| 988 | 724 | } |