| @@ -3,20 +3,14 @@ | ||
| 3 | 3 | * Initialize all the dependency classes |
| 4 | 4 | * |
| 5 | 5 | * @package Tutor |
| 6 | 6 | * @author Themeum <support@themeum.com> |
| 7 | - * @link https://www.themeum.com/ | |
| 7 | + * @link https://themeum.com | |
| 8 | 8 | * @since 1.0.0 |
| 9 | 9 | */ |
| 10 | 10 | |
| 11 | 11 | namespace TUTOR; |
| 12 | 12 | |
| 13 | -use Tutor\Models\CourseModel; | |
| 14 | -use Tutor\Ecommerce\Ecommerce; | |
| 15 | -use Tutor\GDPR\GDPR; | |
| 16 | -use Tutor\Helpers\QueryHelper; | |
| 17 | -use Tutor\Migrations\Migration; | |
| 18 | - | |
| 19 | 13 | if ( ! defined( 'ABSPATH' ) ) { |
| 20 | 14 | exit; |
| 21 | 15 | } |
| 22 | 16 | |
| @@ -24,10 +18,9 @@ | ||
| 24 | 18 | * Tutor final class |
| 25 | 19 | * |
| 26 | 20 | * @since 1.0.0 |
| 27 | 21 | */ |
| 28 | -final class Tutor extends Singleton { | |
| 29 | - | |
| 22 | +final class Tutor { | |
| 30 | 23 | /** |
| 31 | 24 | * Tutor version |
| 32 | 25 | * |
| 33 | 26 | * @since 1.0.0 |
| @@ -63,8 +56,18 @@ | ||
| 63 | 56 | */ |
| 64 | 57 | public $basename; |
| 65 | 58 | |
| 66 | 59 | /** |
| 60 | + * The single instance of the class. | |
| 61 | + * | |
| 62 | + * @since 1.2.0 | |
| 63 | + * | |
| 64 | + * @var object | |
| 65 | + */ | |
| 66 | + protected static $_instance = null; | |
| 67 | + | |
| 68 | + | |
| 69 | + /** | |
| 67 | 70 | * Utils class object |
| 68 | 71 | * |
| 69 | 72 | * @since 1.1.0 |
| 70 | 73 | * |
| @@ -159,9 +162,9 @@ | ||
| 159 | 162 | * @since 1.1.0 |
| 160 | 163 | * |
| 161 | 164 | * @var object |
| 162 | 165 | */ |
| 163 | - public $lesson; | |
| 166 | + private $lesson; | |
| 164 | 167 | |
| 165 | 168 | /** |
| 166 | 169 | * Rewrite_Rules class object |
| 167 | 170 | * |
| @@ -234,17 +237,8 @@ | ||
| 234 | 237 | */ |
| 235 | 238 | private $user; |
| 236 | 239 | |
| 237 | 240 | /** |
| 238 | - * UserPreference class object | |
| 239 | - * | |
| 240 | - * @since 4.0.0 | |
| 241 | - * | |
| 242 | - * @var UserPreference | |
| 243 | - */ | |
| 244 | - private $user_preference; | |
| 245 | - | |
| 246 | - /** | |
| 247 | 241 | * Theme_Compatibility class object |
| 248 | 242 | * |
| 249 | 243 | * @since 1.1.0 |
| 250 | 244 | * |
| @@ -355,11 +349,11 @@ | ||
| 355 | 349 | * Announcement |
| 356 | 350 | * |
| 357 | 351 | * @since 2.0.0 |
| 358 | 352 | * |
| 359 | - * @var object | |
| 353 | + * @var $announcements | |
| 360 | 354 | */ |
| 361 | - public $announcements; | |
| 355 | + private $announcements; | |
| 362 | 356 | |
| 363 | 357 | /** |
| 364 | 358 | * Reviews class object |
| 365 | 359 | * |
| @@ -375,9 +369,9 @@ | ||
| 375 | 369 | * @since 1.1.0 |
| 376 | 370 | * |
| 377 | 371 | * @var object |
| 378 | 372 | */ |
| 379 | - public $withdraw_list; | |
| 373 | + private $withdraw_list; | |
| 380 | 374 | |
| 381 | 375 | /** |
| 382 | 376 | * Student_List class object |
| 383 | 377 | * |
| @@ -384,9 +378,9 @@ | ||
| 384 | 378 | * @since 1.1.0 |
| 385 | 379 | * |
| 386 | 380 | * @var object |
| 387 | 381 | */ |
| 388 | - public $student_list; | |
| 382 | + private $student_list; | |
| 389 | 383 | |
| 390 | 384 | /** |
| 391 | 385 | * Instructor_List class object |
| 392 | 386 | * |
| @@ -393,15 +387,14 @@ | ||
| 393 | 387 | * @since 1.1.0 |
| 394 | 388 | * |
| 395 | 389 | * @var object |
| 396 | 390 | */ |
| 397 | - public $instructor_list; | |
| 391 | + private $instructor_list; | |
| 398 | 392 | |
| 399 | 393 | /** |
| 400 | 394 | * Course List |
| 401 | 395 | * |
| 402 | - * @var Course_List | |
| 403 | - * | |
| 396 | + * @var $course_list | |
| 404 | 397 | * @since 2.0.0 |
| 405 | 398 | */ |
| 406 | 399 | public $course_list; |
| 407 | 400 | |
| @@ -439,8 +432,22 @@ | ||
| 439 | 432 | */ |
| 440 | 433 | private $permalink; |
| 441 | 434 | |
| 442 | 435 | /** |
| 436 | + * Run the TUTOR | |
| 437 | + * | |
| 438 | + * @since 1.2.0 | |
| 439 | + * | |
| 440 | + * @return null|Tutor | |
| 441 | + */ | |
| 442 | + public static function instance() { | |
| 443 | + if ( is_null( self::$_instance ) ) { | |
| 444 | + self::$_instance = new self(); | |
| 445 | + } | |
| 446 | + return self::$_instance; | |
| 447 | + } | |
| 448 | + | |
| 449 | + /** | |
| 443 | 450 | * Initialize props & other dependencies |
| 444 | 451 | * |
| 445 | 452 | * @since 1.0.0 |
| 446 | 453 | */ |
| @@ -455,25 +462,17 @@ | ||
| 455 | 462 | * |
| 456 | 463 | * @since 1.4.2 |
| 457 | 464 | */ |
| 458 | 465 | global $wpdb; |
| 459 | - $wpdb->tutor_earnings = $wpdb->prefix . 'tutor_earnings'; | |
| 460 | - $wpdb->tutor_gradebooks = $wpdb->prefix . 'tutor_gradebooks'; | |
| 461 | - $wpdb->tutor_gradebooks_results = $wpdb->prefix . 'tutor_gradebooks_results'; | |
| 462 | - $wpdb->tutor_quiz_attempts = $wpdb->prefix . 'tutor_quiz_attempts'; | |
| 463 | - $wpdb->tutor_quiz_attempt_answers = $wpdb->prefix . 'tutor_quiz_attempt_answers'; | |
| 464 | - $wpdb->tutor_quiz_questions = $wpdb->prefix . 'tutor_quiz_questions'; | |
| 465 | - $wpdb->tutor_quiz_question_answers = $wpdb->prefix . 'tutor_quiz_question_answers'; | |
| 466 | - $wpdb->tutor_withdraws = $wpdb->prefix . 'tutor_withdraws'; | |
| 467 | - $wpdb->tutor_email_queue = $wpdb->prefix . 'tutor_email_queue'; | |
| 468 | - $wpdb->tutor_order_items = $wpdb->prefix . 'tutor_order_items'; | |
| 469 | - $wpdb->tutor_orders = $wpdb->prefix . 'tutor_orders'; | |
| 470 | - $wpdb->tutor_ordermeta = $wpdb->prefix . 'tutor_ordermeta'; | |
| 471 | - $wpdb->tutor_subscription_plan_items = $wpdb->prefix . 'tutor_subscription_plan_items'; | |
| 472 | - $wpdb->tutor_subscription_plans = $wpdb->prefix . 'tutor_subscription_plans'; | |
| 473 | - $wpdb->tutor_subscriptions = $wpdb->prefix . 'tutor_subscriptions'; | |
| 474 | - $wpdb->tutor_subscriptionmeta = $wpdb->prefix . 'tutor_subscriptionmeta'; | |
| 475 | - $wpdb->tutor_order_itemmeta = $wpdb->prefix . 'tutor_order_itemmeta'; | |
| 466 | + $wpdb->tutor_earnings = $wpdb->prefix . 'tutor_earnings'; | |
| 467 | + $wpdb->tutor_gradebooks = $wpdb->prefix . 'tutor_gradebooks'; | |
| 468 | + $wpdb->tutor_gradebooks_results = $wpdb->prefix . 'tutor_gradebooks_results'; | |
| 469 | + $wpdb->tutor_quiz_attempts = $wpdb->prefix . 'tutor_quiz_attempts'; | |
| 470 | + $wpdb->tutor_quiz_attempt_answers = $wpdb->prefix . 'tutor_quiz_attempt_answers'; | |
| 471 | + $wpdb->tutor_quiz_questions = $wpdb->prefix . 'tutor_quiz_questions'; | |
| 472 | + $wpdb->tutor_quiz_question_answers = $wpdb->prefix . 'tutor_quiz_question_answers'; | |
| 473 | + $wpdb->tutor_withdraws = $wpdb->prefix . 'tutor_withdraws'; | |
| 474 | + $wpdb->tutor_email_queue = $wpdb->prefix . 'tutor_email_queue'; | |
| 476 | 475 | |
| 477 | 476 | /** |
| 478 | 477 | * Changing default wp doing ajax return based on tutor ajax action |
| 479 | 478 | */ |
| @@ -483,12 +482,15 @@ | ||
| 483 | 482 | * Include Files |
| 484 | 483 | */ |
| 485 | 484 | $this->includes(); |
| 486 | 485 | |
| 486 | + /** | |
| 487 | + * Loading Auto loader | |
| 488 | + */ | |
| 489 | + spl_autoload_register( array( $this, 'loader' ) ); | |
| 490 | + | |
| 487 | 491 | do_action( 'tutor_before_load' ); |
| 488 | 492 | |
| 489 | - GDPR::get_instance(); | |
| 490 | - | |
| 491 | 493 | $this->addons = new Addons(); |
| 492 | 494 | $this->post_types = new Post_types(); |
| 493 | 495 | $this->taxonomies = new Taxonomies(); |
| 494 | 496 | $this->assets = new Assets(); |
| @@ -507,13 +509,13 @@ | ||
| 507 | 509 | $this->q_attempt = new Quiz_Attempts_List(); |
| 508 | 510 | $this->quiz = new Quiz(); |
| 509 | 511 | $this->tools = new Tools(); |
| 510 | 512 | $this->user = new User(); |
| 511 | - $this->user_preference = new UserPreference(); | |
| 512 | 513 | $this->theme_compatibility = new Theme_Compatibility(); |
| 513 | 514 | $this->gutenberg = new Gutenberg(); |
| 514 | 515 | $this->course_settings_tabs = new Course_Settings_Tabs(); |
| 515 | 516 | $this->withdraw = new Withdraw(); |
| 517 | + $this->course_widget = new Course_Widget(); | |
| 516 | 518 | $this->upgrader = new Upgrader(); |
| 517 | 519 | $this->dashboard = new Dashboard(); |
| 518 | 520 | $this->form_handler = new FormHandler(); |
| 519 | 521 | $this->frontend = new Frontend(); |
| @@ -541,32 +543,11 @@ | ||
| 541 | 543 | $this->course_embed = new Course_Embed(); |
| 542 | 544 | $this->rest_auth = new RestAuth(); |
| 543 | 545 | |
| 544 | 546 | /** |
| 545 | - * New Course Builder. | |
| 546 | - * | |
| 547 | - * @since 3.0.0 | |
| 548 | - */ | |
| 549 | - new QuizBuilder(); | |
| 550 | - | |
| 551 | - /** | |
| 552 | - * Tutor native e-commerce | |
| 553 | - * | |
| 554 | - * @since 3.0.0 | |
| 555 | - */ | |
| 556 | - new Ecommerce(); | |
| 557 | - | |
| 558 | - /** | |
| 559 | - * Data migrations | |
| 560 | - * | |
| 561 | - * @since 3.8.0 | |
| 562 | - */ | |
| 563 | - new Migration(); | |
| 564 | - | |
| 565 | - /** | |
| 566 | 547 | * Run Method |
| 567 | 548 | * |
| 568 | - * @since 1.2.0 | |
| 549 | + * @since v.1.2.0 | |
| 569 | 550 | */ |
| 570 | 551 | $this->run(); |
| 571 | 552 | |
| 572 | 553 | do_action( 'tutor_loaded' ); |
| @@ -571,9 +552,8 @@ | ||
| 571 | 552 | |
| 572 | 553 | do_action( 'tutor_loaded' ); |
| 573 | 554 | |
| 574 | 555 | add_action( 'init', array( $this, 'init_action' ) ); |
| 575 | - add_action( 'init', array( $this, 'update_instructor_capability' ) ); | |
| 576 | 556 | |
| 577 | 557 | /** |
| 578 | 558 | * Check activated plugin |
| 579 | 559 | * |
| @@ -587,10 +567,8 @@ | ||
| 587 | 567 | * |
| 588 | 568 | * @since 2.8.0 |
| 589 | 569 | */ |
| 590 | 570 | add_action( 'admin_init', array( $this, 'redirect_to_setup_page' ) ); |
| 591 | - | |
| 592 | - // add_filter( 'rest_request_before_callbacks', array( $this, 'enforce_courses_privacy_rest_api' ), 10, 3 ); | |
| 593 | 571 | } |
| 594 | 572 | |
| 595 | 573 | /** |
| 596 | 574 | * Check activated plugin |
| @@ -606,9 +584,8 @@ | ||
| 606 | 584 | if ( tutor()->basename === $plugin ) { |
| 607 | 585 | $this->redirect_to_setup_page(); |
| 608 | 586 | } |
| 609 | 587 | } |
| 610 | - | |
| 611 | 588 | /** |
| 612 | 589 | * Redirect to setup page |
| 613 | 590 | * |
| 614 | 591 | * @since 2.8.0 |
| @@ -618,12 +595,9 @@ | ||
| 618 | 595 | public function redirect_to_setup_page() { |
| 619 | 596 | if ( ( ! get_option( 'tutor_wizard' ) ) && version_compare( TUTOR_VERSION, '1.5.6', '>' ) ) { |
| 620 | 597 | if ( ! wp_doing_ajax() ) { |
| 621 | 598 | update_option( 'tutor_wizard', 'active' ); |
| 622 | - $is_wp_cli = defined( 'WP_CLI' ) && WP_CLI; | |
| 623 | - if ( ! $is_wp_cli ) { | |
| 624 | - wp_safe_redirect( admin_url( 'admin.php?page=tutor-setup' ) ); | |
| 625 | - } | |
| 599 | + wp_safe_redirect( admin_url( 'admin.php?page=tutor-setup' ) ); | |
| 626 | 600 | exit; |
| 627 | 601 | } |
| 628 | 602 | } |
| 629 | 603 | } |
| @@ -628,41 +602,43 @@ | ||
| 628 | 602 | } |
| 629 | 603 | } |
| 630 | 604 | |
| 631 | 605 | /** |
| 632 | - * Include utility functions | |
| 606 | + * Auto Load class and the files | |
| 633 | 607 | * |
| 608 | + * @since 1.0.0 | |
| 609 | + * | |
| 610 | + * @param string $class_name class name to load. | |
| 611 | + * | |
| 634 | 612 | * @return void |
| 635 | 613 | */ |
| 636 | - public function includes() { | |
| 637 | - $tutor_path = plugin_dir_path( TUTOR_FILE ); | |
| 614 | + private function loader( $class_name ) { | |
| 615 | + if ( ! class_exists( $class_name ) ) { | |
| 616 | + $class_name = preg_replace( | |
| 617 | + array( '/([a-z])([A-Z])/', '/\\\/' ), | |
| 618 | + array( '$1$2', DIRECTORY_SEPARATOR ), | |
| 619 | + $class_name | |
| 620 | + ); | |
| 638 | 621 | |
| 639 | - include $tutor_path . 'includes/tutor-general-functions.php'; | |
| 640 | - include $tutor_path . 'includes/tutor-template-functions.php'; | |
| 641 | - include $tutor_path . 'includes/tutor-template-hook.php'; | |
| 642 | - include $tutor_path . 'includes/translate-text.php'; | |
| 643 | - include $tutor_path . 'includes/country.php'; | |
| 644 | - include $tutor_path . 'includes/ecommerce-functions.php'; | |
| 622 | + $class_name = str_replace( 'TUTOR' . DIRECTORY_SEPARATOR, 'classes' . DIRECTORY_SEPARATOR, $class_name ); | |
| 623 | + $file_name = $this->path . $class_name . '.php'; | |
| 645 | 624 | |
| 646 | - if ( ! function_exists( 'is_plugin_active' ) ) { | |
| 647 | - require_once ABSPATH . 'wp-admin/includes/plugin.php'; | |
| 625 | + if ( file_exists( $file_name ) ) { | |
| 626 | + require_once $file_name; | |
| 627 | + } | |
| 648 | 628 | } |
| 629 | + } | |
| 649 | 630 | |
| 650 | - // Only kirki latest has class KirkiMain. | |
| 651 | - $is_kirki_active = \is_plugin_active( 'kirki-pro/kirki-pro.php' ) && class_exists( 'KirkiProMain' ); | |
| 652 | - | |
| 653 | - if ( $is_kirki_active ) { | |
| 654 | - $tutor_kirki_path = $tutor_path . 'includes/kirki/kirki.php'; | |
| 655 | - if ( file_exists( $tutor_kirki_path ) ) { | |
| 656 | - include $tutor_kirki_path; | |
| 657 | - } | |
| 658 | - } else { | |
| 659 | - $is_droip_active = \is_plugin_active( 'droip/droip.php' ); | |
| 660 | - $tutor_droip_path = $tutor_path . 'includes/droip/droip.php'; | |
| 661 | - if ( $is_droip_active && file_exists( $tutor_droip_path ) ) { | |
| 662 | - include $tutor_droip_path; | |
| 663 | - } | |
| 664 | - } | |
| 631 | + /** | |
| 632 | + * Include utility functions | |
| 633 | + * | |
| 634 | + * @return void | |
| 635 | + */ | |
| 636 | + public function includes() { | |
| 637 | + include tutor()->path . 'includes/tutor-general-functions.php'; | |
| 638 | + include tutor()->path . 'includes/tutor-template-functions.php'; | |
| 639 | + include tutor()->path . 'includes/tutor-template-hook.php'; | |
| 640 | + include tutor()->path . 'includes/translate-text.php'; | |
| 665 | 641 | } |
| 666 | 642 | |
| 667 | 643 | /** |
| 668 | 644 | * Providing hooks |
| @@ -687,15 +663,10 @@ | ||
| 687 | 663 | } |
| 688 | 664 | |
| 689 | 665 | /** |
| 690 | 666 | * Do some task during plugin activation |
| 691 | - * | |
| 692 | - * @since 4.0.0 Flush rewrite rules on activation. | |
| 693 | 667 | */ |
| 694 | 668 | public static function tutor_activate() { |
| 695 | - // Rewrite Flush. | |
| 696 | - Permalink::set_permalink_flag(); | |
| 697 | - | |
| 698 | 669 | $version = get_option( 'tutor_version' ); |
| 699 | 670 | if ( ! function_exists( 'tutor_time' ) ) { |
| 700 | 671 | include tutor()->path . 'includes/tutor-general-functions.php'; |
| 701 | 672 | } |
| @@ -708,8 +679,10 @@ | ||
| 708 | 679 | |
| 709 | 680 | $options = self::default_options(); |
| 710 | 681 | update_option( 'tutor_option', $options ); |
| 711 | 682 | |
| 683 | + // Rewrite Flush. | |
| 684 | + Permalink::set_permalink_flag(); | |
| 712 | 685 | self::manage_tutor_roles_and_permissions(); |
| 713 | 686 | |
| 714 | 687 | // Save initial Page. |
| 715 | 688 | self::save_data(); |
| @@ -730,8 +703,10 @@ | ||
| 730 | 703 | */ |
| 731 | 704 | self::create_withdraw_database(); |
| 732 | 705 | // Update the tutor version. |
| 733 | 706 | update_option( 'tutor_version', '1.2.0' ); |
| 707 | + // Rewrite Flush. | |
| 708 | + Permalink::set_permalink_flag(); | |
| 734 | 709 | } |
| 735 | 710 | |
| 736 | 711 | /** |
| 737 | 712 | * Backward Compatibility to < 1.3.1 for make course plural |
| @@ -742,8 +717,9 @@ | ||
| 742 | 717 | if ( ! get_option( 'is_course_post_type_updated' ) ) { |
| 743 | 718 | $wpdb->update( $wpdb->posts, array( 'post_type' => tutor()->course_post_type ), array( 'post_type' => 'course' ) ); |
| 744 | 719 | update_option( 'is_course_post_type_updated', true ); |
| 745 | 720 | update_option( 'tutor_version', '1.3.1' ); |
| 721 | + Permalink::set_permalink_flag(); | |
| 746 | 722 | } |
| 747 | 723 | } |
| 748 | 724 | |
| 749 | 725 | /** |
| @@ -803,14 +779,9 @@ | ||
| 803 | 779 | attempt_started_at datetime DEFAULT NULL, |
| 804 | 780 | attempt_ended_at datetime DEFAULT NULL, |
| 805 | 781 | is_manually_reviewed int(1) DEFAULT NULL, |
| 806 | 782 | manually_reviewed_at datetime DEFAULT NULL, |
| 807 | - result varchar(10) DEFAULT NULL, | |
| 808 | - PRIMARY KEY (attempt_id), | |
| 809 | - INDEX (course_id), | |
| 810 | - INDEX (quiz_id), | |
| 811 | - INDEX (user_id), | |
| 812 | - INDEX (result) | |
| 783 | + PRIMARY KEY (attempt_id) | |
| 813 | 784 | ) $charset_collate;"; |
| 814 | 785 | |
| 815 | 786 | $quiz_attempt_answers = "CREATE TABLE {$wpdb->prefix}tutor_quiz_attempt_answers ( |
| 816 | 787 | attempt_answer_id bigint(20) NOT NULL AUTO_INCREMENT, |
| @@ -870,13 +841,9 @@ | ||
| 870 | 841 | deduct_fees_name varchar(250) DEFAULT NULL, |
| 871 | 842 | deduct_fees_type varchar(20) DEFAULT NULL, |
| 872 | 843 | process_by varchar(20) DEFAULT NULL, |
| 873 | 844 | created_at datetime DEFAULT NULL, |
| 874 | - PRIMARY KEY (earning_id), | |
| 875 | - INDEX (user_id), | |
| 876 | - INDEX (course_id), | |
| 877 | - INDEX (order_id), | |
| 878 | - INDEX (process_by) | |
| 845 | + PRIMARY KEY (earning_id) | |
| 879 | 846 | ) $charset_collate;"; |
| 880 | 847 | |
| 881 | 848 | $withdraw_table = "CREATE TABLE IF NOT EXISTS {$wpdb->prefix}tutor_withdraws ( |
| 882 | 849 | withdraw_id bigint(20) NOT NULL AUTO_INCREMENT, |
| @@ -888,160 +855,8 @@ | ||
| 888 | 855 | created_at datetime DEFAULT NULL, |
| 889 | 856 | PRIMARY KEY (withdraw_id) |
| 890 | 857 | ) $charset_collate;"; |
| 891 | 858 | |
| 892 | - $orders_table = "CREATE TABLE {$wpdb->prefix}tutor_orders ( | |
| 893 | - id BIGINT(20) UNSIGNED AUTO_INCREMENT, | |
| 894 | - parent_id BIGINT(20) UNSIGNED DEFAULT 0, -- for subscription order, store subscription record id | |
| 895 | - transaction_id VARCHAR(255) COMMENT 'Transaction id from payment gateway', | |
| 896 | - user_id BIGINT(20) UNSIGNED NOT NULL, | |
| 897 | - order_type VARCHAR(50) NOT NULL, -- single_order, subscription | |
| 898 | - order_status VARCHAR(50) NOT NULL, | |
| 899 | - payment_status VARCHAR(50) NOT NULL, | |
| 900 | - subtotal_price DECIMAL(13, 2) NOT NULL, -- price calculation based on course sale price | |
| 901 | - pre_tax_price DECIMAL(13, 2) NOT NULL, -- total price before adding tax | |
| 902 | - tax_type VARCHAR(50), | |
| 903 | - tax_rate DECIMAL(13, 2) COMMENT 'Tax percentage', | |
| 904 | - tax_amount DECIMAL(13, 2), | |
| 905 | - total_price DECIMAL(13, 2) NOT NULL, -- final price | |
| 906 | - net_payment DECIMAL(13, 2) NOT NULL, -- calculated price if any refund is done else same as total_price | |
| 907 | - coupon_code VARCHAR(255), | |
| 908 | - coupon_amount DECIMAL(13, 2), | |
| 909 | - discount_type ENUM('percentage', 'flat') DEFAULT NULL, | |
| 910 | - discount_amount DECIMAL(13, 2), | |
| 911 | - discount_reason TEXT, | |
| 912 | - fees DECIMAL(13, 2), -- payment gateway fees | |
| 913 | - earnings DECIMAL(13, 2), -- net earning | |
| 914 | - refund_amount DECIMAL(13, 2), -- Refund amount | |
| 915 | - payment_method VARCHAR(255), | |
| 916 | - payment_payloads LONGTEXT, | |
| 917 | - note TEXT, | |
| 918 | - created_at_gmt DATETIME NOT NULL, | |
| 919 | - created_by BIGINT(20) UNSIGNED NOT NULL, | |
| 920 | - updated_at_gmt DATETIME, | |
| 921 | - updated_by BIGINT(20) UNSIGNED NOT NULL, | |
| 922 | - PRIMARY KEY (id), | |
| 923 | - KEY user_id (user_id), | |
| 924 | - KEY order_type (order_type), | |
| 925 | - KEY payment_status (payment_status), | |
| 926 | - KEY order_status (order_status), | |
| 927 | - KEY transaction_id (transaction_id) | |
| 928 | - ) $charset_collate;"; | |
| 929 | - | |
| 930 | - $order_meta_table = "CREATE TABLE {$wpdb->prefix}tutor_ordermeta ( | |
| 931 | - id BIGINT(20) UNSIGNED NOT NULL AUTO_INCREMENT, | |
| 932 | - order_id BIGINT(20) UNSIGNED NOT NULL, | |
| 933 | - meta_key VARCHAR(255) NOT NULL, | |
| 934 | - meta_value LONGTEXT NOT NULL, | |
| 935 | - created_at_gmt DATETIME NOT NULL, | |
| 936 | - created_by BIGINT(20) UNSIGNED NOT NULL, | |
| 937 | - updated_at_gmt DATETIME, | |
| 938 | - updated_by BIGINT(20) UNSIGNED NOT NULL, | |
| 939 | - PRIMARY KEY (id), | |
| 940 | - KEY order_id (order_id), | |
| 941 | - KEY meta_key (meta_key), | |
| 942 | - CONSTRAINT fk_tutor_ordermeta_order_id FOREIGN KEY (order_id) REFERENCES {$wpdb->prefix}tutor_orders(id) ON DELETE CASCADE | |
| 943 | - ) $charset_collate;"; | |
| 944 | - | |
| 945 | - $order_items_table = "CREATE TABLE {$wpdb->prefix}tutor_order_items ( | |
| 946 | - id BIGINT(20) UNSIGNED NOT NULL AUTO_INCREMENT, | |
| 947 | - order_id BIGINT(20) UNSIGNED NOT NULL, | |
| 948 | - item_id BIGINT(20) UNSIGNED NOT NULL, -- course id/plan id | |
| 949 | - regular_price DECIMAL(13, 2) NOT NULL, -- course regular price | |
| 950 | - sale_price VARCHAR(13) DEFAULT NULL, -- course sale price | |
| 951 | - discount_price VARCHAR(13) DEFAULT NULL, -- course discount price | |
| 952 | - coupon_code VARCHAR(255) DEFAULT NULL, -- coupon code | |
| 953 | - PRIMARY KEY (id), | |
| 954 | - KEY order_id (order_id), | |
| 955 | - KEY item_id (item_id), | |
| 956 | - CONSTRAINT fk_tutor_order_item_order_id FOREIGN KEY (order_id) REFERENCES {$wpdb->prefix}tutor_orders(id) ON DELETE CASCADE | |
| 957 | - ) $charset_collate;"; | |
| 958 | - | |
| 959 | - $coupons_table = "CREATE TABLE {$wpdb->prefix}tutor_coupons ( | |
| 960 | - id BIGINT(20) UNSIGNED NOT NULL AUTO_INCREMENT, | |
| 961 | - coupon_status VARCHAR(50), | |
| 962 | - coupon_type VARCHAR(100) DEFAULT 'code', -- coupon type 'code' or 'automatic' | |
| 963 | - coupon_code VARCHAR(50) NOT NULL, | |
| 964 | - coupon_title VARCHAR(255) NOT NULL, | |
| 965 | - coupon_description TEXT, | |
| 966 | - discount_type ENUM('percentage', 'flat') NOT NULL, | |
| 967 | - discount_amount DECIMAL(13, 2) NOT NULL, | |
| 968 | - applies_to VARCHAR(100) DEFAULT 'all_courses_and_bundles', -- possible values 'all_courses_and_bundles', 'all_courses', 'all_bundles', 'specific_courses', 'specific_bundles', 'specific_category' | |
| 969 | - total_usage_limit INT(10) UNSIGNED DEFAULT NULL, -- null for unlimited usage | |
| 970 | - per_user_usage_limit TINYINT(4) UNSIGNED DEFAULT NULL, -- null for unlimited usage | |
| 971 | - purchase_requirement VARCHAR(50) DEFAULT 'no_minimum', -- possible values 'no_minimum', 'minimum_purchase', 'minimum_quantity' | |
| 972 | - purchase_requirement_value DECIMAL(13, 2), | |
| 973 | - start_date_gmt DATETIME NOT NULL, | |
| 974 | - expire_date_gmt DATETIME DEFAULT NULL, | |
| 975 | - created_at_gmt DATETIME NOT NULL, | |
| 976 | - created_by BIGINT(20) UNSIGNED NOT NULL, | |
| 977 | - updated_at_gmt DATETIME, | |
| 978 | - updated_by BIGINT(20) UNSIGNED NOT NULL, | |
| 979 | - PRIMARY KEY (id), | |
| 980 | - UNIQUE KEY coupon_code (coupon_code), | |
| 981 | - KEY start_date_gmt (start_date_gmt), | |
| 982 | - KEY expire_date_gmt (expire_date_gmt) | |
| 983 | - ) $charset_collate;"; | |
| 984 | - | |
| 985 | - $coupon_applications_table = "CREATE TABLE {$wpdb->prefix}tutor_coupon_applications ( | |
| 986 | - coupon_code VARCHAR(50) NOT NULL, | |
| 987 | - reference_id BIGINT(20) UNSIGNED NOT NULL, | |
| 988 | - KEY coupon_code (coupon_code), | |
| 989 | - KEY reference_id (reference_id), | |
| 990 | - CONSTRAINT fk_tutor_coupon_application_coupon_code FOREIGN KEY (coupon_code) REFERENCES {$wpdb->prefix}tutor_coupons(coupon_code) ON DELETE CASCADE | |
| 991 | - ) $charset_collate;"; | |
| 992 | - | |
| 993 | - $coupon_usage_table = "CREATE TABLE {$wpdb->prefix}tutor_coupon_usages ( | |
| 994 | - id BIGINT(20) UNSIGNED NOT NULL AUTO_INCREMENT, | |
| 995 | - coupon_code VARCHAR(50) NOT NULL, | |
| 996 | - user_id BIGINT(20) UNSIGNED NOT NULL, | |
| 997 | - PRIMARY KEY (id), | |
| 998 | - KEY coupon_code (coupon_code), | |
| 999 | - KEY user_id (user_id), | |
| 1000 | - CONSTRAINT fk_tutor_coupon_usage_coupon_code FOREIGN KEY (coupon_code) REFERENCES {$wpdb->prefix}tutor_coupons(coupon_code) ON DELETE CASCADE, | |
| 1001 | - CONSTRAINT fk_tutor_coupon_usage_user_id FOREIGN KEY (user_id) REFERENCES {$wpdb->prefix}users(ID) ON DELETE CASCADE | |
| 1002 | - ) $charset_collate;"; | |
| 1003 | - | |
| 1004 | - $cart_table = "CREATE TABLE {$wpdb->prefix}tutor_carts ( | |
| 1005 | - id BIGINT(20) UNSIGNED NOT NULL AUTO_INCREMENT, | |
| 1006 | - user_id BIGINT(20) UNSIGNED DEFAULT NULL, | |
| 1007 | - coupon_code VARCHAR(50) DEFAULT NULL, | |
| 1008 | - created_at_gmt DATETIME NOT NULL, | |
| 1009 | - updated_at_gmt DATETIME, | |
| 1010 | - PRIMARY KEY (id), | |
| 1011 | - KEY user_id (user_id), | |
| 1012 | - KEY coupon_code (coupon_code), | |
| 1013 | - CONSTRAINT fk_tutor_cart_user_id FOREIGN KEY (user_id) REFERENCES {$wpdb->prefix}users(ID) ON DELETE CASCADE | |
| 1014 | - ) $charset_collate;"; | |
| 1015 | - | |
| 1016 | - $cart_items_table = "CREATE TABLE {$wpdb->prefix}tutor_cart_items ( | |
| 1017 | - id BIGINT(20) UNSIGNED NOT NULL AUTO_INCREMENT, | |
| 1018 | - cart_id BIGINT(20) UNSIGNED NOT NULL, | |
| 1019 | - course_id BIGINT(20) UNSIGNED NOT NULL, | |
| 1020 | - PRIMARY KEY (id), | |
| 1021 | - KEY cart_id (cart_id), | |
| 1022 | - KEY course_id (course_id), | |
| 1023 | - CONSTRAINT fk_tutor_cart_item_cart_id FOREIGN KEY (cart_id) REFERENCES {$wpdb->prefix}tutor_carts(id) ON DELETE CASCADE, | |
| 1024 | - CONSTRAINT fk_tutor_cart_item_course_id FOREIGN KEY (course_id) REFERENCES {$wpdb->prefix}posts(ID) ON DELETE CASCADE | |
| 1025 | - ) $charset_collate;"; | |
| 1026 | - | |
| 1027 | - $customer_table = "CREATE TABLE {$wpdb->prefix}tutor_customers ( | |
| 1028 | - id BIGINT(20) UNSIGNED NOT NULL AUTO_INCREMENT, | |
| 1029 | - user_id BIGINT(20) UNSIGNED DEFAULT NULL, | |
| 1030 | - billing_first_name VARCHAR(255) NOT NULL, | |
| 1031 | - billing_last_name VARCHAR(255) NOT NULL, | |
| 1032 | - billing_email VARCHAR(255) NOT NULL, | |
| 1033 | - billing_phone VARCHAR(20) NOT NULL, | |
| 1034 | - billing_zip_code VARCHAR(20) NOT NULL, | |
| 1035 | - billing_address TEXT NOT NULL, | |
| 1036 | - billing_country VARCHAR(100) NOT NULL, | |
| 1037 | - billing_state VARCHAR(100) NOT NULL, | |
| 1038 | - billing_city VARCHAR(100) NOT NULL, | |
| 1039 | - PRIMARY KEY (id), | |
| 1040 | - KEY user_id (user_id), | |
| 1041 | - KEY billing_email (billing_email) | |
| 1042 | - ) $charset_collate;"; | |
| 1043 | - | |
| 1044 | 859 | require_once ABSPATH . 'wp-admin/includes/upgrade.php'; |
| 1045 | 860 | dbDelta( $quiz_attempts_sql ); |
| 1046 | 861 | dbDelta( $quiz_attempt_answers ); |
| 1047 | 862 | dbDelta( $tutor_quiz_questions ); |
| @@ -1047,17 +862,8 @@ | ||
| 1047 | 862 | dbDelta( $tutor_quiz_questions ); |
| 1048 | 863 | dbDelta( $tutor_quiz_question_answers ); |
| 1049 | 864 | dbDelta( $earning_table ); |
| 1050 | 865 | dbDelta( $withdraw_table ); |
| 1051 | - dbDelta( $orders_table ); | |
| 1052 | - dbDelta( $order_meta_table ); | |
| 1053 | - dbDelta( $order_items_table ); | |
| 1054 | - dbDelta( $coupons_table ); | |
| 1055 | - dbDelta( $coupon_applications_table ); | |
| 1056 | - dbDelta( $coupon_usage_table ); | |
| 1057 | - dbDelta( $cart_table ); | |
| 1058 | - dbDelta( $cart_items_table ); | |
| 1059 | - dbDelta( $customer_table ); | |
| 1060 | 866 | } |
| 1061 | 867 | |
| 1062 | 868 | /** |
| 1063 | 869 | * Manage tutor roles & permission |
| @@ -1082,8 +888,10 @@ | ||
| 1082 | 888 | 'read_tutor_course', |
| 1083 | 889 | 'delete_tutor_course', |
| 1084 | 890 | 'delete_tutor_courses', |
| 1085 | 891 | 'edit_tutor_courses', |
| 892 | + 'edit_others_tutor_courses', | |
| 893 | + 'read_private_tutor_courses', | |
| 1086 | 894 | 'edit_tutor_courses', |
| 1087 | 895 | |
| 1088 | 896 | 'edit_tutor_lesson', |
| 1089 | 897 | 'read_tutor_lesson', |
| @@ -1089,8 +897,10 @@ | ||
| 1089 | 897 | 'read_tutor_lesson', |
| 1090 | 898 | 'delete_tutor_lesson', |
| 1091 | 899 | 'delete_tutor_lessons', |
| 1092 | 900 | 'edit_tutor_lessons', |
| 901 | + 'edit_others_tutor_lessons', | |
| 902 | + 'read_private_tutor_lessons', | |
| 1093 | 903 | 'edit_tutor_lessons', |
| 1094 | 904 | 'publish_tutor_lessons', |
| 1095 | 905 | |
| 1096 | 906 | 'edit_tutor_quiz', |
| @@ -1097,8 +907,10 @@ | ||
| 1097 | 907 | 'read_tutor_quiz', |
| 1098 | 908 | 'delete_tutor_quiz', |
| 1099 | 909 | 'delete_tutor_quizzes', |
| 1100 | 910 | 'edit_tutor_quizzes', |
| 911 | + 'edit_others_tutor_quizzes', | |
| 912 | + 'read_private_tutor_quizzes', | |
| 1101 | 913 | 'edit_tutor_quizzes', |
| 1102 | 914 | 'publish_tutor_quizzes', |
| 1103 | 915 | |
| 1104 | 916 | 'edit_tutor_question', |
| @@ -1105,9 +917,11 @@ | ||
| 1105 | 917 | 'read_tutor_question', |
| 1106 | 918 | 'delete_tutor_question', |
| 1107 | 919 | 'delete_tutor_questions', |
| 1108 | 920 | 'edit_tutor_questions', |
| 921 | + 'edit_others_tutor_questions', | |
| 1109 | 922 | 'publish_tutor_questions', |
| 923 | + 'read_private_tutor_questions', | |
| 1110 | 924 | 'edit_tutor_questions', |
| 1111 | 925 | ); |
| 1112 | 926 | |
| 1113 | 927 | $instructor = get_role( $instructor_role ); |
| @@ -1194,10 +1008,8 @@ | ||
| 1194 | 1008 | * Default options |
| 1195 | 1009 | * |
| 1196 | 1010 | * @since 1.0.0 |
| 1197 | 1011 | * |
| 1198 | - * @since 3.4.1 Supported video sources added | |
| 1199 | - * | |
| 1200 | 1012 | * @return array |
| 1201 | 1013 | */ |
| 1202 | 1014 | public static function default_options() { |
| 1203 | 1015 | $options = array( |
| @@ -1206,11 +1018,11 @@ | ||
| 1206 | 1018 | 'display_course_instructors' => '1', |
| 1207 | 1019 | 'enable_q_and_a_on_course' => '1', |
| 1208 | 1020 | 'courses_col_per_row' => '3', |
| 1209 | 1021 | 'courses_per_page' => '12', |
| 1210 | - 'course_permalink_base' => 'courses', | |
| 1211 | - 'lesson_permalink_base' => 'lessons', | |
| 1022 | + 'lesson_permalink_base' => 'lesson', | |
| 1212 | 1023 | 'quiz_when_time_expires' => 'autosubmit', |
| 1024 | + 'quiz_attempts_allowed' => '10', | |
| 1213 | 1025 | 'quiz_grade_method' => 'highest_grade', |
| 1214 | 1026 | 'enable_public_profile' => '1', |
| 1215 | 1027 | 'email_to_students' => |
| 1216 | 1028 | array( |
| @@ -1227,28 +1039,12 @@ | ||
| 1227 | 1039 | 'email_from_name' => get_option( 'blogname' ), |
| 1228 | 1040 | 'email_from_address' => get_option( 'admin_email' ), |
| 1229 | 1041 | 'email_footer_text' => '', |
| 1230 | 1042 | 'earning_admin_commission' => '20', |
| 1043 | + 'earning_admin_commission' => '20', | |
| 1231 | 1044 | 'earning_instructor_commission' => '80', |
| 1232 | - | |
| 1233 | - // Default options for tutor ecommerce. | |
| 1234 | - 'monetize_by' => Ecommerce::MONETIZE_BY, | |
| 1235 | - 'currency_code' => 'USD', | |
| 1236 | - 'currency_position' => 'left', | |
| 1237 | - 'thousand_separator' => ',', | |
| 1238 | - 'decimal_separator' => '.', | |
| 1239 | - 'number_of_decimals' => '2', | |
| 1240 | - 'is_coupon_applicable' => 'on', | |
| 1241 | - 'supported_video_sources' => array( | |
| 1242 | - 'html5', | |
| 1243 | - 'external_url', | |
| 1244 | - 'youtube', | |
| 1245 | - 'vimeo', | |
| 1246 | - 'embedded', | |
| 1247 | - 'shortcode', | |
| 1248 | - ), | |
| 1045 | + 'color_preset_type' => 'default', | |
| 1249 | 1046 | ); |
| 1250 | - | |
| 1251 | 1047 | return $options; |
| 1252 | 1048 | } |
| 1253 | 1049 | |
| 1254 | 1050 | |
| @@ -1372,23 +1168,23 @@ | ||
| 1372 | 1168 | 'tutor_enrolled', |
| 1373 | 1169 | 'tutor_announcements', |
| 1374 | 1170 | ); |
| 1375 | 1171 | |
| 1376 | - $in_clause = QueryHelper::prepare_in_clause( $post_types ); | |
| 1377 | - $tutor_posts = $wpdb->get_col( $wpdb->prepare( "SELECT ID from {$wpdb->posts} WHERE post_type IN({$in_clause}) ;" ) ); //phpcs:ignore WordPress.DB.PreparedSQL.InterpolatedNotPrepared | |
| 1172 | + $post_type_strings = "'" . implode( "','", $post_types ) . "'"; | |
| 1173 | + $tutor_posts = $wpdb->get_col( "SELECT ID from {$wpdb->posts} WHERE post_type in({$post_type_strings}) ;" ); //phpcs:ignore WordPress.DB.PreparedSQL.InterpolatedNotPrepared | |
| 1378 | 1174 | |
| 1379 | 1175 | if ( is_array( $tutor_posts ) && count( $tutor_posts ) ) { |
| 1380 | 1176 | foreach ( $tutor_posts as $post_id ) { |
| 1381 | 1177 | // Delete categories. |
| 1382 | - $terms = wp_get_object_terms( $post_id, CourseModel::COURSE_CATEGORY ); | |
| 1178 | + $terms = wp_get_object_terms( $post_id, 'course-category' ); | |
| 1383 | 1179 | foreach ( $terms as $term ) { |
| 1384 | - wp_remove_object_terms( $post_id, array( $term->term_id ), CourseModel::COURSE_CATEGORY ); | |
| 1180 | + wp_remove_object_terms( $post_id, array( $term->term_id ), 'course-category' ); | |
| 1385 | 1181 | } |
| 1386 | 1182 | |
| 1387 | 1183 | // Delete tags if available. |
| 1388 | - $terms = wp_get_object_terms( $post_id, CourseModel::COURSE_TAG ); | |
| 1184 | + $terms = wp_get_object_terms( $post_id, 'course-tag' ); | |
| 1389 | 1185 | foreach ( $terms as $term ) { |
| 1390 | - wp_remove_object_terms( $post_id, array( $term->term_id ), CourseModel::COURSE_TAG ); | |
| 1186 | + wp_remove_object_terms( $post_id, array( $term->term_id ), 'course-tag' ); | |
| 1391 | 1187 | } |
| 1392 | 1188 | |
| 1393 | 1189 | // Delete All Meta. |
| 1394 | 1190 | $wpdb->delete( $wpdb->postmeta, array( 'post_id' => $post_id ) ); |
| @@ -1398,12 +1194,12 @@ | ||
| 1398 | 1194 | |
| 1399 | 1195 | /** |
| 1400 | 1196 | * Deleting Comments (reviews, questions, quiz_answers, etc) |
| 1401 | 1197 | */ |
| 1402 | - $tutor_comments = $wpdb->get_col( "SELECT comment_ID from {$wpdb->comments} WHERE comment_agent = 'comment_agent' ;" ); | |
| 1198 | + $tutor_comments = $wpdb->get_col( "SELECT comment_ID from {$wpdb->comments} WHERE comment_agent = 'comment_agent' ;" ); | |
| 1199 | + $comments_ids_strings = "'" . implode( "','", $tutor_comments ) . "'"; | |
| 1403 | 1200 | if ( is_array( $tutor_comments ) && count( $tutor_comments ) ) { |
| 1404 | - $in_clause = QueryHelper::prepare_in_clause( $tutor_comments ); | |
| 1405 | - $wpdb->query( $wpdb->prepare( "DELETE from {$wpdb->commentmeta} WHERE comment_ID in({$in_clause}) " ) ); //phpcs:ignore WordPress.DB.PreparedSQL.InterpolatedNotPrepared | |
| 1201 | + $wpdb->query( "DELETE from {$wpdb->commentmeta} WHERE comment_ID in({$comments_ids_strings}) " ); //phpcs:ignore WordPress.DB.PreparedSQL.InterpolatedNotPrepared | |
| 1406 | 1202 | } |
| 1407 | 1203 | $wpdb->delete( $wpdb->comments, array( 'comment_agent' => 'comment_agent' ) ); |
| 1408 | 1204 | |
| 1409 | 1205 | /** |
| @@ -1421,62 +1217,7 @@ | ||
| 1421 | 1217 | $prefix = $wpdb->prefix; |
| 1422 | 1218 | //phpcs:ignore WordPress.DB.PreparedSQL.InterpolatedNotPrepared |
| 1423 | 1219 | $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 " ); |
| 1424 | 1220 | |
| 1425 | - } | |
| 1426 | - } | |
| 1427 | - | |
| 1428 | - /** | |
| 1429 | - * Update instructor capability | |
| 1430 | - * | |
| 1431 | - * Remove other author items permission | |
| 1432 | - * | |
| 1433 | - * @since 4.0.5 | |
| 1434 | - * | |
| 1435 | - * @since 4.0.6 read_private_{items} permissions removed | |
| 1436 | - */ | |
| 1437 | - public function update_instructor_capability() { | |
| 1438 | - // Remove edit_others content cap from tutor_instructor role. | |
| 1439 | - $is_removed_edit_other_items_permissions = get_option( 'tutor_removed_edit_other_items_permission', false ); | |
| 1440 | - $is_removed_private_items_permissions = get_option( 'tutor_removed_read_private_items_permission', false ); | |
| 1441 | - | |
| 1442 | - $role = get_role( tutor()->instructor_role ); | |
| 1443 | - if ( ! $is_removed_edit_other_items_permissions ) { | |
| 1444 | - $role = get_role( tutor()->instructor_role ); | |
| 1445 | - | |
| 1446 | - $caps_to_be_removed = array( | |
| 1447 | - 'edit_others_tutor_courses', | |
| 1448 | - 'edit_others_tutor_lessons', | |
| 1449 | - 'edit_others_tutor_quizzes', | |
| 1450 | - 'edit_others_tutor_questions', | |
| 1451 | - 'edit_others_tutor_assignments', | |
| 1452 | - ); | |
| 1453 | - | |
| 1454 | - foreach ( $caps_to_be_removed as $cap ) { | |
| 1455 | - if ( $role->has_cap( $cap ) ) { | |
| 1456 | - $role->remove_cap( $cap ); | |
| 1457 | - } | |
| 1458 | - } | |
| 1459 | - | |
| 1460 | - update_option( 'tutor_removed_edit_other_items_permission', true, false ); | |
| 1461 | - } | |
| 1462 | - | |
| 1463 | - // Removed private items permission @since 4.0.6. | |
| 1464 | - if ( ! $is_removed_private_items_permissions ) { | |
| 1465 | - $caps_to_be_removed = array( | |
| 1466 | - 'read_private_tutor_courses', | |
| 1467 | - 'read_private_tutor_lessons', | |
| 1468 | - 'read_private_tutor_quizzes', | |
| 1469 | - 'read_private_tutor_assignments', | |
| 1470 | - 'read_private_tutor_questions', | |
| 1471 | - ); | |
| 1472 | - | |
| 1473 | - foreach ( $caps_to_be_removed as $cap ) { | |
| 1474 | - if ( $role->has_cap( $cap ) ) { | |
| 1475 | - $role->remove_cap( $cap ); | |
| 1476 | - } | |
| 1477 | - } | |
| 1478 | - | |
| 1479 | - update_option( 'tutor_removed_read_private_items_permission', true, false ); | |
| 1480 | 1221 | } |
| 1481 | 1222 | } |
| 1482 | 1223 | } |