PluginProbe
FluentCommunity – Ultra-Fast High-Performance Social Network, Community, LMS & Online Courses / 2.10.0
FluentCommunity – Ultra-Fast High-Performance Social Network, Community, LMS & Online Courses v2.10.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 1.1.0 All 77 releases
← All changes | Modules/Course/Services/CourseHelper.php +35 -11 2.7.02.10.0 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,14 +555,22 @@
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 - $core_styles_keys = array('block-supports');
547 - // Adds comment if code is prettified to identify core styles sections in debugging.
548 - foreach ($core_styles_keys as $style_key) {
549 - $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 + }
572 + }
550 573 }
551 574 }
552 575
553 576 if (!$content) {
@@ -592,8 +615,11 @@
592 615
593 616 $newLessonMeta = $newLesson->meta;
594 617 $newLessonMeta['document_lists'] = [];
595 618 foreach ($lesson->media as $media) {
619 + if (!$media->is_active) {
620 + continue;
621 + }
596 622 $newMedia = $media->replicate();
597 623 $newMedia->feed_id = $newLesson->id;
598 624 $newMedia->save();
599 625 if ($media->object_source == 'lesson_document') {
@@ -600,12 +626,10 @@
600 626 $newLessonMeta['document_lists'][] = $newMedia->getPrivateFileMeta();
601 627 }
602 628 }
603 629
604 - if (!empty($newLessonMeta['document_lists'])) {
605 - $newLesson->meta = $newLessonMeta;
606 - $newLesson->save();
607 - }
630 + $newLesson->meta = $newLessonMeta;
631 + $newLesson->save();
608 632 }
609 633
610 634 public static function getAccessMessage($course, $lesson, $config)
611 635 {