PluginProbe
LearnPress – WordPress LMS Plugin for Create and Sell Online Courses / 4.4.8
LearnPress – WordPress LMS Plugin for Create and Sell Online Courses v4.4.8
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 4.2.0 All 139 releases
← All changes | inc/TemplateHooks/Course/AdminEditCurriculumTemplate.php +11 -13 4.3.74.4.8 View file →
@@ -13,11 +13,8 @@
13 13 use LearnPress\Models\PostModel;
14 14 use LearnPress\Models\UserModel;
15 15 use LearnPress\TemplateHooks\Admin\AdminTemplate;
16 16 use LearnPress\TemplateHooks\TemplateAJAX;
17 -use LP_Database;
18 -use LP_Post_DB;
19 -use LP_Post_Type_Filter;
20 17 use stdClass;
21 18
22 19 /**
23 20 * Template hooks Admin Edit Course Curriculum.
@@ -42,9 +39,9 @@
42 39 * @var array
43 40 */
44 41 public $context_data = [];
45 42
46 - public function init() {
43 + public function init(): void {
47 44 add_action( 'learn-press/admin/edit-curriculum/layout', [ $this, 'edit_course_curriculum_layout' ] );
48 45 add_filter( 'lp/rest/ajax/allow_callback', [ $this, 'allow_callback' ] );
49 46 }
50 47
@@ -385,9 +382,9 @@
385 382 'action' => 'course_add_section',
386 383 'course_id' => $this->courseModel->get_id(),
387 384 'id_url' => 'course-add-section',
388 385 ]
389 - ),
386 + )
390 387 ),
391 388 'button' => sprintf(
392 389 '<button type="button"
393 390 class="lp-btn-add-section button lp-btn-edit-primary">%s
@@ -608,9 +605,9 @@
608 605 * Else get all items created by user current.
609 606 *
610 607 * @throws Exception
611 608 * @since 4.2.8.6
612 - * @version 1.0.4
609 + * @version 1.0.5
613 610 */
614 611 public static function render_list_items_not_assign( $data ): stdClass {
615 612 $user = wp_get_current_user();
616 613 $content = new stdClass();
@@ -664,9 +661,9 @@
664 661 $data,
665 662 $courseModel
666 663 );
667 664 $posts = $lp_posts_db->get_posts( $filter, $total_rows );
668 - $total_pages = LP_Database::get_total_pages( $filter->limit, $total_rows );
665 + $total_pages = DataBase::get_total_pages( $filter->limit, $total_rows );
669 666
670 667 $html_lis = '';
671 668 if ( empty( $posts ) ) {
672 669 $html_lis = sprintf( '<li>%s</li>', __( 'No items found', 'learnpress' ) );
@@ -672,14 +669,14 @@
672 669 $html_lis = sprintf( '<li>%s</li>', __( 'No items found', 'learnpress' ) );
673 670 } else {
674 671 if ( ! empty( $item_selecting ) ) {
675 672 foreach ( $item_selecting as $item ) {
676 - if ( ! isset( $item['item_id'] ) || ! isset( $item['item_type'] ) ) {
673 + if ( ! isset( $item['id'] ) || ! isset( $item['type'] ) ) {
677 674 continue;
678 675 }
679 676
680 - $item_selecting_compare->{$item['item_id']} = new stdClass();
681 - $item_selecting_compare->{$item['item_id']}->item_type = $item['item_type'];
677 + $item_selecting_compare->{$item['id']} = new stdClass();
678 + $item_selecting_compare->{$item['id']}->item_type = $item['type'];
682 679 }
683 680 }
684 681
685 682 foreach ( $posts as $post ) {
@@ -685,9 +682,9 @@
685 682 foreach ( $posts as $post ) {
686 683 /**
687 684 * @var $itemModel PostModel
688 685 */
689 - $itemModel = $courseModel->get_item_model( $post->ID, $post->post_type );
686 + $itemModel = $courseModel->get_item_model( $post->ID, $post->post_type, false );
690 687 if ( ! $itemModel ) {
691 688 continue;
692 689 }
693 690
@@ -692,9 +689,10 @@
692 689 }
693 690
694 691 $checked = '';
695 692
696 - if ( isset( $item_selecting_compare->{$post->ID} ) ) {
693 + if ( isset( $item_selecting_compare->{$post->ID} )
694 + && $item_selecting_compare->{$post->ID}->item_type === $post->post_type ) {
697 695 $checked = ' checked="checked"';
698 696 }
699 697
700 698 $title_display = sprintf(
@@ -699,9 +697,9 @@
699 697
700 698 $title_display = sprintf(
701 699 '<span class="title">%s<strong>(#%d)</strong></span>',
702 700 $post->post_title,
703 - $post->ID,
701 + $post->ID
704 702 );
705 703
706 704 $html_lis .= sprintf(
707 705 '<li class="lp-select-item">%s%s</li>',