PluginProbe
FluentCommunity – Ultra-Fast High-Performance Social Network, Community, LMS & Online Courses / 2.11.0
FluentCommunity – Ultra-Fast High-Performance Social Network, Community, LMS & Online Courses v2.11.0
2.11.0 2.10.0 2.10.01 2.9.1 2.9.0 2.8.1 2.8.0 2.7.7 2.7.5 2.7.0 2.6.01 2.6.0 2.5.0 2.4.01 trunk 1.0.90 1.0.91 1.0.92 1.0.93 1.0.94 1.0.95 1.0.96 1.0.97 1.0.98 1.0.99 All 78 releases
← All changes | Modules/Course/Services/CourseHelper.php +35 -10 2.8.12.11.0 View file →
@@ -435,20 +435,24 @@
435 435 'auto_complete_on_video_end'
436 436 ];
437 437
438 438 if ($lesson->isQuizType()) {
439 - $quizFields = ['quiz_questions', 'passing_score', 'enable_passing_score', 'enforce_passing_score', 'hide_result'];
439 + $quizFields = ['quiz_questions', 'passing_score', 'enable_passing_score', 'enforce_passing_score', 'hide_result', 'shuffle_options', 'shuffle_questions', 'layout'];
440 440 $validFields = wp_parse_args($validFields, $quizFields);
441 441 }
442 442
443 443 $meta = Arr::only($meta, $validFields);
444 444
445 - $yesNoFields = ['enable_comments', 'enable_media', 'free_preview_lesson', 'require_video_completion', 'auto_complete_on_video_end', 'enable_passing_score', 'enforce_passing_score', 'hide_result'];
445 + $yesNoFields = ['enable_comments', 'enable_media', 'free_preview_lesson', 'require_video_completion', 'auto_complete_on_video_end', 'enable_passing_score', 'enforce_passing_score', 'hide_result', 'shuffle_options', 'shuffle_questions'];
446 446
447 447 foreach ($yesNoFields as $field) {
448 448 $meta[$field] = Arr::get($meta, $field, 'no') == 'yes' ? 'yes' : 'no';
449 449 }
450 450
451 + if ($lesson->isQuizType()) {
452 + $meta['layout'] = Arr::get($meta, 'layout') === 'one_by_one' ? 'one_by_one' : 'all';
453 + }
454 +
451 455 if (Arr::get($meta, 'enable_media') == 'yes') {
452 456 if ($media = Arr::get($meta, 'media', [])) {
453 457 $meta['media'] = self::sanitizeMedia($media);
454 458 }
@@ -489,9 +493,24 @@
489 493 public static function getCourseCategories()
490 494 {
491 495 $terms = Term::whereHas('base_spaces', function ($q) {
492 496 $q->where('type', 'course');
493 - })->get();
497 + })->orderBy('title', 'ASC')->get();
498 + // Respect the admin-defined order (settings.serial)
499 + $terms = $terms->sort(function ($a, $b) {
500 + $serialA = Arr::get($a->settings, 'serial');
501 + $serialB = Arr::get($b->settings, 'serial');
502 + if ($serialA === null && $serialB === null) {
503 + return 0;
504 + }
505 + if ($serialA === null) {
506 + return 1;
507 + }
508 + if ($serialB === null) {
509 + return -1;
510 + }
511 + return (int) $serialA <=> (int) $serialB;
512 + })->values();
494 513
495 514 $formattedTerms = [];
496 515
497 516 foreach ($terms as $term) {
@@ -540,15 +559,21 @@
540 559
541 560 $inlineCss = '';
542 561 if ($parseContent && $canViewLesson) {
543 562 $content = $lesson->message_rendered;
544 - if (!$content && $lesson->message) {
545 - $content = apply_filters('the_content', $lesson->message); // phpcs:ignore WordPress.NamingConventions.PrefixAllGlobals.NonPrefixedHooknameFound
546 - if (function_exists('wp_style_engine_get_stylesheet_from_context')) {
547 - $core_styles_keys = array('block-supports');
548 - // Adds comment if code is prettified to identify core styles sections in debugging.
549 - foreach ($core_styles_keys as $style_key) {
550 - $inlineCss .= wp_style_engine_get_stylesheet_from_context($style_key, []);
563 +
564 + // message_rendered still holding block markup never went through the_content
565 + if (!$content || has_blocks($content)) {
566 + $source = $lesson->message ?: $content;
567 +
568 + if ($source) {
569 + $content = apply_filters('the_content', $source); // phpcs:ignore WordPress.NamingConventions.PrefixAllGlobals.NonPrefixedHooknameFound
570 + if (function_exists('wp_style_engine_get_stylesheet_from_context')) {
571 + $core_styles_keys = array('block-supports');
572 + // Adds comment if code is prettified to identify core styles sections in debugging.
573 + foreach ($core_styles_keys as $style_key) {
574 + $inlineCss .= wp_style_engine_get_stylesheet_from_context($style_key, []);
575 + }
551 576 }
552 577 }
553 578 }
554 579