From ea74578da3573478701d42a1dda9646fd74a772d Mon Sep 17 00:00:00 2001 From: Anindra Das Bivas Date: Fri, 19 Jun 2026 13:03:30 +0600 Subject: [PATCH 1/2] Check if bundle constant is defined --- templates/course/course-carousel.php | 4 ++-- templates/course/course-list.php | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/templates/course/course-carousel.php b/templates/course/course-carousel.php index 21194b7..b154cb3 100644 --- a/templates/course/course-carousel.php +++ b/templates/course/course-carousel.php @@ -13,8 +13,8 @@ */ if ( ! function_exists( 'is_bundle_enabled' ) ) { function is_bundle_enabled() { - $basename = plugin_basename( TUTOR_COURSE_BUNDLE_FILE ); - $is_enabled = tutor_utils()->is_addon_enabled( $basename ); + $basename = defined( 'TUTOR_COURSE_BUNDLE_FILE' ) ? plugin_basename( TUTOR_COURSE_BUNDLE_FILE ) : ''; + $is_enabled = $basename ? tutor_utils()->is_addon_enabled( $basename ) : false; return $is_enabled; } } diff --git a/templates/course/course-list.php b/templates/course/course-list.php index 652bfc9..98a4cb0 100644 --- a/templates/course/course-list.php +++ b/templates/course/course-list.php @@ -20,8 +20,8 @@ // check for plugin using tutor pro if ( ! function_exists( 'is_bundle_enabled' ) ) { function is_bundle_enabled() { - $basename = plugin_basename( TUTOR_COURSE_BUNDLE_FILE ); - $is_enabled = tutor_utils()->is_addon_enabled( $basename ); + $basename = defined( 'TUTOR_COURSE_BUNDLE_FILE' ) ? plugin_basename( TUTOR_COURSE_BUNDLE_FILE ) : ''; + $is_enabled = $basename ? tutor_utils()->is_addon_enabled( $basename ) : false; return $is_enabled; } } From 407e3a60d3bd9c7c9300e82ce8618bfa717b243b Mon Sep 17 00:00:00 2001 From: Anindra Das Bivas Date: Fri, 19 Jun 2026 15:20:50 +0600 Subject: [PATCH 2/2] updated condition --- templates/course/course-carousel.php | 9 +-------- templates/course/course-list.php | 10 +--------- 2 files changed, 2 insertions(+), 17 deletions(-) diff --git a/templates/course/course-carousel.php b/templates/course/course-carousel.php index b154cb3..87f2f36 100644 --- a/templates/course/course-carousel.php +++ b/templates/course/course-carousel.php @@ -11,14 +11,7 @@ /* * query arguments */ - if ( ! function_exists( 'is_bundle_enabled' ) ) { - function is_bundle_enabled() { - $basename = defined( 'TUTOR_COURSE_BUNDLE_FILE' ) ? plugin_basename( TUTOR_COURSE_BUNDLE_FILE ) : ''; - $is_enabled = $basename ? tutor_utils()->is_addon_enabled( $basename ) : false; - return $is_enabled; - } - } - if ( in_array( 'tutor-pro/tutor-pro.php', apply_filters( 'active_plugins', get_option( 'active_plugins' ) ) ) && is_bundle_enabled() ) { + if ( tutor_utils()->is_addon_enabled( 'course-bundle' ) ) { // plugin is activated $carosel_postype = array( 'courses', 'course-bundle' ); } else { diff --git a/templates/course/course-list.php b/templates/course/course-list.php index 98a4cb0..107ee10 100644 --- a/templates/course/course-list.php +++ b/templates/course/course-list.php @@ -17,16 +17,8 @@ * query arguments */ $paged = isset( $_GET['current_page'] ) ? sanitize_text_field( $_GET['current_page'] ) : 1; - // check for plugin using tutor pro - if ( ! function_exists( 'is_bundle_enabled' ) ) { - function is_bundle_enabled() { - $basename = defined( 'TUTOR_COURSE_BUNDLE_FILE' ) ? plugin_basename( TUTOR_COURSE_BUNDLE_FILE ) : ''; - $is_enabled = $basename ? tutor_utils()->is_addon_enabled( $basename ) : false; - return $is_enabled; - } - } - if ( in_array( 'tutor-pro/tutor-pro.php', apply_filters( 'active_plugins', get_option( 'active_plugins' ) ), true ) && is_bundle_enabled() ) { + if ( tutor_utils()->is_addon_enabled( 'course-bundle' ) ) { // plugin is activated $listing_postype = array( 'courses', 'course-bundle' ); } else {