From 4cd94ae0052e40823a544643b28655b3d2bb39d9 Mon Sep 17 00:00:00 2001 From: Brian Hogg Date: Mon, 16 Dec 2024 09:19:01 -0500 Subject: [PATCH] Fix start date error (#2811) * Check if there is a start date before showing the course opens message. --- .changelogs/fix_start-date-error.yml | 5 +++++ templates/content-single-course-before.php | 3 +-- 2 files changed, 6 insertions(+), 2 deletions(-) create mode 100644 .changelogs/fix_start-date-error.yml diff --git a/.changelogs/fix_start-date-error.yml b/.changelogs/fix_start-date-error.yml new file mode 100644 index 0000000000..730fe362b8 --- /dev/null +++ b/.changelogs/fix_start-date-error.yml @@ -0,0 +1,5 @@ +significance: patch +type: fixed +links: + - "#2810" +entry: Avoid showing course opens message if no Course Start Date has been set. diff --git a/templates/content-single-course-before.php b/templates/content-single-course-before.php index 5ffbb9c667..95c7b82434 100644 --- a/templates/content-single-course-before.php +++ b/templates/content-single-course-before.php @@ -17,7 +17,7 @@ if ( 'yes' === $course->get( 'time_period' ) ) { // If the start date hasn't passed yet. - if ( ! $course->has_date_passed( 'start_date' ) ) { + if ( $course->get( 'start_date' ) && ! $course->has_date_passed( 'start_date' ) ) { llms_add_notice( $course->get( 'course_opens_message' ), 'notice' ); @@ -30,4 +30,3 @@ llms_print_notices(); do_action( 'lifterlms_single_course_before_summary' ); -