PluginProbe
FluentCommunity – Ultra-Fast High-Performance Social Network, Community, LMS & Online Courses / 2.10.01
FluentCommunity – Ultra-Fast High-Performance Social Network, Community, LMS & Online Courses v2.10.01
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 1.1.0 All 77 releases
← All changes | Modules/Course/Services/CourseHelper.php +34 -12 2.7.72.10.01 View file →
@@ -489,9 +489,24 @@
489 489 public static function getCourseCategories()
490 490 {
491 491 $terms = Term::whereHas('base_spaces', function ($q) {
492 492 $q->where('type', 'course');
493 - })->get();
493 + })->orderBy('title', 'ASC')->get();
494 + // Respect the admin-defined order (settings.serial)
495 + $terms = $terms->sort(function ($a, $b) {
496 + $serialA = Arr::get($a->settings, 'serial');
497 + $serialB = Arr::get($b->settings, 'serial');
498 + if ($serialA === null && $serialB === null) {
499 + return 0;
500 + }
501 + if ($serialA === null) {
502 + return 1;
503 + }
504 + if ($serialB === null) {
505 + return -1;
506 + }
507 + return (int) $serialA <=> (int) $serialB;
508 + })->values();
494 509
495 510 $formattedTerms = [];
496 511
497 512 foreach ($terms as $term) {
@@ -540,15 +555,21 @@
540 555
541 556 $inlineCss = '';
542 557 if ($parseContent && $canViewLesson) {
543 558 $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, []);
559 +
560 + // message_rendered still holding block markup never went through the_content
561 + if (!$content || has_blocks($content)) {
562 + $source = $lesson->message ?: $content;
563 +
564 + if ($source) {
565 + $content = apply_filters('the_content', $source); // phpcs:ignore WordPress.NamingConventions.PrefixAllGlobals.NonPrefixedHooknameFound
566 + if (function_exists('wp_style_engine_get_stylesheet_from_context')) {
567 + $core_styles_keys = array('block-supports');
568 + // Adds comment if code is prettified to identify core styles sections in debugging.
569 + foreach ($core_styles_keys as $style_key) {
570 + $inlineCss .= wp_style_engine_get_stylesheet_from_context($style_key, []);
571 + }
551 572 }
552 573 }
553 574 }
554 575
@@ -594,8 +615,11 @@
594 615
595 616 $newLessonMeta = $newLesson->meta;
596 617 $newLessonMeta['document_lists'] = [];
597 618 foreach ($lesson->media as $media) {
619 + if (!$media->is_active) {
620 + continue;
621 + }
598 622 $newMedia = $media->replicate();
599 623 $newMedia->feed_id = $newLesson->id;
600 624 $newMedia->save();
601 625 if ($media->object_source == 'lesson_document') {
@@ -602,12 +626,10 @@
602 626 $newLessonMeta['document_lists'][] = $newMedia->getPrivateFileMeta();
603 627 }
604 628 }
605 629
606 - if (!empty($newLessonMeta['document_lists'])) {
607 - $newLesson->meta = $newLessonMeta;
608 - $newLesson->save();
609 - }
630 + $newLesson->meta = $newLessonMeta;
631 + $newLesson->save();
610 632 }
611 633
612 634 public static function getAccessMessage($course, $lesson, $config)
613 635 {