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/CourseBuilder/CourseBuilderAjax.php +10 -1 4.4.7 → 4.4.9 View file →
@@ -1396,10 +1396,13 @@
1396 1396 }
1397 1397
1398 1398 /**
1399 1399 * Save Lesson Settings
1400 + * @throws Exception
1400 1401 */
1401 1402 protected function save_lesson_settings_to_model( LessonPostModel $lessonModel, array $data ) {
1403 + $must_save = 0;
1404 +
1402 1405 if ( isset( $data['_lp_duration'] ) ) {
1403 1406 $duration = ! empty( $data['_lp_duration'] ) ? str_replace( ',', ' ', $data['_lp_duration'] ) : '0 minute';
1404 1407 $explode = explode( ' ', $duration );
1405 1408 $number = (float) $explode[0] < 0 ? 0 : absint( $explode[0] );
@@ -1404,14 +1407,20 @@
1404 1407 $explode = explode( ' ', $duration );
1405 1408 $number = (float) $explode[0] < 0 ? 0 : absint( $explode[0] );
1406 1409 $unit = $explode[1] ?? 'minute';
1407 1410
1408 - $lessonModel->save_meta_value_by_key( '_lp_duration', $number . ' ' . $unit );
1411 + $lessonModel->set_meta_value_by_key( $lessonModel::META_KEY_DURATION, $number . ' ' . $unit );
1412 + $must_save = 1;
1409 1413 }
1410 1414
1411 1415 if ( isset( $data['_lp_preview'] ) ) {
1412 1416 $enable = $data['_lp_preview'] === 'yes';
1413 1417 $lessonModel->set_preview( $enable );
1418 + $must_save = 1;
1419 + }
1420 +
1421 + if ( $must_save ) {
1422 + $lessonModel->save();
1414 1423 }
1415 1424
1416 1425 /**
1417 1426 * Allow addons to persist their own lesson settings fields added to the