PluginProbe
LearnPress – WordPress LMS Plugin for Create and Sell Online Courses / 4.4.9
LearnPress – WordPress LMS Plugin for Create and Sell Online Courses v4.4.9
4.4.9 4.4.8 4.4.7 4.4.6 4.4.5 4.4.4 4.4.3 4.4.2 4.4.1 4.4.0 4.3.9.1 4.3.9 4.3.8 4.3.7 4.1.6.9 4.1.6.9.1 4.1.6.9.2 4.1.6.9.3 4.1.6.9.4 4.1.7 4.1.7.1 4.1.7.2 4.1.7.3 4.1.7.3.1 4.1.7.3.2 All 140 releases
← All changes | inc/admin/class-lp-admin.php +40 -20 4.3.7 → 4.4.9 View file →
@@ -5,9 +5,12 @@
5 5 * @version 1.0.2
6 6 */
7 7
8 8 use LearnPress\Background\LPBackgroundAjax;
9 +use LearnPress\Helpers\Template;
9 10 use LearnPress\Models\CourseModel;
11 +use LearnPress\TemplateHooks\Admin\Notices\AdminNotesTemplate;
12 +use LearnPress\TemplateHooks\TemplateAJAX;
10 13 use LearnPress\TemplateHooks\CourseBuilder\Course\BuilderCourseTemplate;
11 14
12 15 defined( 'ABSPATH' ) || exit;
13 16
@@ -34,9 +37,9 @@
34 37 ];
35 38 $this->includes();
36 39 add_action( 'delete_user', array( $this, 'delete_user_data' ) );
37 40 //add_action( 'delete_user_form', array( $this, 'delete_user_form' ) );
38 - add_action( 'all_admin_notices', array( $this, 'admin_notices' ), - 1 );
41 + add_action( 'admin_footer', array( $this, 'admin_notices' ) );
39 42 add_action( 'admin_enqueue_scripts', array( $this, 'load_modal' ) );
40 43 add_filter( 'admin_body_class', array( $this, 'body_class' ) );
41 44 //add_filter( 'manage_users_custom_column', array( $this, 'users_custom_column' ), 10, 3 );
42 45 //add_filter( 'manage_pages_columns', array( $this, 'page_columns_head' ) );
@@ -655,17 +658,8 @@
655 658 return;
656 659 }
657 660 }
658 661
659 - // Show template file templates override.
660 - $page = LP_Request::get_param( 'page' );
661 - $tab = LP_Request::get_param( 'tab' );
662 - if ( $page == 'learn-press-tools' && $tab == 'templates' ) {
663 - if ( LP_Outdated_Template_Helper::detect_outdated_template() ) {
664 - learn_press_admin_view( 'html-admin-notice-templates' );
665 - }
666 - }
667 -
668 662 // Request accept/denied user can become a teacher.
669 663 $action_become_teacher = LP_Request::get_param( 'lp-action' );
670 664 $user_id = LP_Request::get_param( 'user_id', 0, 'int' );
671 665 $type_action_become_teacher = array( 'accepted-request', 'denied-request' );
@@ -683,9 +677,30 @@
683 677 </div>
684 678 <?php
685 679 }
686 680
687 - learn_press_admin_view( 'admin-notices.php', [], true );
681 + // Load Ajax notes here
682 + /** @use AdminNotesTemplate::render_notices */
683 + $html_notices = TemplateAJAX::load_content_via_ajax(
684 + [
685 + 'method_request' => 'GET',
686 + 'id_url' => 'admin-notices',
687 + 'html_loading_before_show_content' => '',
688 + ],
689 + [
690 + 'class' => AdminNotesTemplate::class,
691 + 'method' => 'render_notices',
692 + ]
693 + );
694 +
695 + wp_enqueue_script( 'lp-admin-notices' );
696 +
697 + echo Template::instance()->nest_elements(
698 + [
699 + '<div class="learn-press-admin-notices notice">' => '</div>',
700 + ],
701 + $html_notices
702 + );
688 703 }
689 704
690 705 /**
691 706 * Admin footer add review.
@@ -800,13 +815,18 @@
800 815 public function includes() {
801 816 // Common function used in admin
802 817 include_once 'lp-admin-functions.php';
803 818 include_once 'lp-admin-actions.php';
804 - require_once LP_PLUGIN_PATH . 'inc/background-process/class-lp-background-query-items.php';
805 819 include_once 'class-lp-admin-assets.php';
806 820 LP_Admin_Assets::instance();
807 - include_once 'class-lp-admin-mcp-api-keys.php';
808 - LP_Admin_MCP_API_Keys::instance();
821 + // For MCP
822 + if ( learn_press_is_mcp_available() ) {
823 + include_once 'class-lp-admin-mcp-api-keys.php';
824 + LP_Admin_MCP_API_Keys::instance();
825 + }
826 + // End MCP
827 + include_once 'class-lp-admin-webhooks.php';
828 + LP_Admin_Webhooks::instance();
809 829 include_once 'class-lp-admin-dashboard.php';
810 830 // include_once 'class-lp-admin-tools.php';
811 831 include_once 'class-lp-admin-ajax.php';
812 832 include_once 'editor/class-lp-admin-editor.php';
@@ -811,15 +831,14 @@
811 831 include_once 'class-lp-admin-ajax.php';
812 832 include_once 'editor/class-lp-admin-editor.php';
813 833 include_once 'class-lp-admin-menu.php';
814 834 include_once 'helpers/class-lp-outdated-template-helper.php';
815 - include_once 'helpers/class-lp-plugins-helper.php';
816 835 include_once 'class-lp-modal-search-items.php';
817 836 //include_once 'class-lp-modal-search-users.php';
818 837 include_once 'class-lp-setup-wizard.php';
819 838 // include_once 'class-lp-updater.php';
820 - include_once 'class-lp-install-sample-data.php';
821 - include_once 'class-lp-reset-data.php';
839 + // include_once 'class-lp-install-sample-data.php'; // Replaced by LearnPress\Ajax\SampleDataAJAX.
840 + // include_once 'class-lp-reset-data.php'; // Deprecated: replaced by CourseToolsAjax::reset_progress_items_course.
822 841 include_once LP_PLUGIN_PATH . 'inc/admin/views/meta-boxes/course/settings.php';
823 842 include_once LP_PLUGIN_PATH . 'inc/admin/views/meta-boxes/course/class-lp-meta-box-course-offline.php';
824 843 include_once LP_PLUGIN_PATH . 'inc/admin/views/meta-boxes/quiz/settings.php';
825 844 include_once LP_PLUGIN_PATH . 'inc/admin/views/meta-boxes/lesson/settings.php';
@@ -835,9 +854,9 @@
835 854 if ( ! $query->is_main_query() ) {
836 855 return;
837 856 }
838 857
839 - global $post_type, $pagenow;
858 + /*global $post_type, $pagenow;
840 859
841 860 if ( current_user_can( ADMIN_ROLE ) ) {
842 861 return;
843 862 }
@@ -852,13 +871,14 @@
852 871 );
853 872
854 873 if ( ! in_array( $post_type, $post_type_valid ) ) {
855 874 return;
856 - }
875 + }*/
857 876
858 877 // $query->set( 'author', get_current_user_id() );
859 878
860 - $query = apply_filters( 'learnpress/get-post-type-lp-on-backend', $query );
879 + // Hook only Co-instructor using.
880 + return apply_filters( 'learnpress/get-post-type-lp-on-backend', $query );
861 881
862 882 //add_filter( 'views_edit-' . $post_type . '', '_learn_press_restrict_view_items', 10 );
863 883 //remove_filter( 'pre_get_posts', array( $this, 'get_course_items_of_user_backend' ), 10 );
864 884 }