| @@ -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. |