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/Ajax/EditCurriculumAjax.php +6 -5 4.4.6 → 4.4.9 View file →
@@ -485,9 +485,9 @@
485 485 *
486 486 * JS file edit-section-item.js: function updatePreviewItem call this method.
487 487 *
488 488 * @since 4.2.8.6
489 - * @version 1.0.2
489 + * @version 1.0.3
490 490 */
491 491 public static function update_item_preview() {
492 492 $response = new LP_REST_Response();
493 493
@@ -492,12 +492,12 @@
492 492 $response = new LP_REST_Response();
493 493
494 494 try {
495 495 $data = self::check_valid();
496 - $course_id = $data['course_id'] ?? 0;
497 - $item_id = $data['item_id'] ?? 0;
498 - $item_type = $data['item_type'] ?? '';
499 - $enable_preview = $data['enable_preview'] ?? 0;
496 + $course_id = absint( $data['course_id'] ?? 0 );
497 + $item_id = absint( $data['item_id'] ?? 0 );
498 + $item_type = LP_Helper::sanitize_params_submitted( $data['item_type'] ?? '' );
499 + $enable_preview = absint( $data['enable_preview'] ?? 0 );
500 500
501 501 $courseModel = CourseModel::find( $course_id, true );
502 502 if ( ! $courseModel ) {
503 503 throw new Exception( __( 'Course not found', 'learnpress' ) );
@@ -515,8 +515,9 @@
515 515 throw new Exception( __( 'Item not found', 'learnpress' ) );
516 516 }
517 517
518 518 $itemModel->set_preview( $enable_preview == 1 );
519 + $itemModel->save();
519 520
520 521 // Save course to update preview data of item in the curriculum.
521 522 $coursePostModel = new CoursePostModel( $courseModel );
522 523 $coursePostModel->save();