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 +34 -18 4.4.1 → 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,9 +815,8 @@
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 821 // For MCP
808 822 if ( learn_press_is_mcp_available() ) {
@@ -809,8 +823,10 @@
809 823 include_once 'class-lp-admin-mcp-api-keys.php';
810 824 LP_Admin_MCP_API_Keys::instance();
811 825 }
812 826 // End MCP
827 + include_once 'class-lp-admin-webhooks.php';
828 + LP_Admin_Webhooks::instance();
813 829 include_once 'class-lp-admin-dashboard.php';
814 830 // include_once 'class-lp-admin-tools.php';
815 831 include_once 'class-lp-admin-ajax.php';
816 832 include_once 'editor/class-lp-admin-editor.php';
@@ -815,15 +831,14 @@
815 831 include_once 'class-lp-admin-ajax.php';
816 832 include_once 'editor/class-lp-admin-editor.php';
817 833 include_once 'class-lp-admin-menu.php';
818 834 include_once 'helpers/class-lp-outdated-template-helper.php';
819 - include_once 'helpers/class-lp-plugins-helper.php';
820 835 include_once 'class-lp-modal-search-items.php';
821 836 //include_once 'class-lp-modal-search-users.php';
822 837 include_once 'class-lp-setup-wizard.php';
823 838 // include_once 'class-lp-updater.php';
824 - include_once 'class-lp-install-sample-data.php';
825 - 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.
826 841 include_once LP_PLUGIN_PATH . 'inc/admin/views/meta-boxes/course/settings.php';
827 842 include_once LP_PLUGIN_PATH . 'inc/admin/views/meta-boxes/course/class-lp-meta-box-course-offline.php';
828 843 include_once LP_PLUGIN_PATH . 'inc/admin/views/meta-boxes/quiz/settings.php';
829 844 include_once LP_PLUGIN_PATH . 'inc/admin/views/meta-boxes/lesson/settings.php';
@@ -839,9 +854,9 @@
839 854 if ( ! $query->is_main_query() ) {
840 855 return;
841 856 }
842 857
843 - global $post_type, $pagenow;
858 + /*global $post_type, $pagenow;
844 859
845 860 if ( current_user_can( ADMIN_ROLE ) ) {
846 861 return;
847 862 }
@@ -856,13 +871,14 @@
856 871 );
857 872
858 873 if ( ! in_array( $post_type, $post_type_valid ) ) {
859 874 return;
860 - }
875 + }*/
861 876
862 877 // $query->set( 'author', get_current_user_id() );
863 878
864 - $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 );
865 881
866 882 //add_filter( 'views_edit-' . $post_type . '', '_learn_press_restrict_view_items', 10 );
867 883 //remove_filter( 'pre_get_posts', array( $this, 'get_course_items_of_user_backend' ), 10 );
868 884 }