From 8a0703f730e32ba78054c0bd343eb4dceab0802a Mon Sep 17 00:00:00 2001 From: Andrew R Emery Date: Fri, 17 Sep 2021 14:51:38 -0400 Subject: [PATCH 1/2] :sparkles: No profiles template if no plugin --- inc/profiles.php | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/inc/profiles.php b/inc/profiles.php index 30323761..933fa2b0 100644 --- a/inc/profiles.php +++ b/inc/profiles.php @@ -74,3 +74,18 @@ function after_setup_theme() { add_image_size( 'responsive_profile_large', $width, $height, $crop ); } add_action( 'after_setup_theme', __NAMESPACE__ . '\after_setup_theme' ); + +if ( ! defined( 'BU_PROFILES_PLUGIN_ACTIVE' ) ) { + /** + * Removes the profile template if BU profiles is not active. + * + * @param array $page_templates list of registered page templates. + * @return array $page_templates list of registered page templates. + */ + function remove_profile_template( $page_templates ) { + unset( $page_templates['profiles.php'] ); + + return $page_templates; + } + add_filter( 'theme_page_templates', __NAMESPACE__ . '\remove_profile_template' ); +} From 8927843d984c5c2683cdcf97dee42e91d43c1f35 Mon Sep 17 00:00:00 2001 From: Andrew R Emery Date: Mon, 20 Sep 2021 11:02:31 -0400 Subject: [PATCH 2/2] :zap: Improve plugin activation check --- inc/profiles.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/inc/profiles.php b/inc/profiles.php index 933fa2b0..3441cc7f 100644 --- a/inc/profiles.php +++ b/inc/profiles.php @@ -75,7 +75,7 @@ function after_setup_theme() { } add_action( 'after_setup_theme', __NAMESPACE__ . '\after_setup_theme' ); -if ( ! defined( 'BU_PROFILES_PLUGIN_ACTIVE' ) ) { +if ( ! defined( 'BU_PROFILES_PLUGIN_ACTIVE' ) || ! BU_PROFILES_PLUGIN_ACTIVE ) { /** * Removes the profile template if BU profiles is not active. *