diff --git a/mailpoet/lib/EmailEditor/Integrations/MailPoet/DependencyNotice.php b/mailpoet/lib/EmailEditor/Integrations/MailPoet/DependencyNotice.php index 1820beeb57..298543d3f5 100644 --- a/mailpoet/lib/EmailEditor/Integrations/MailPoet/DependencyNotice.php +++ b/mailpoet/lib/EmailEditor/Integrations/MailPoet/DependencyNotice.php @@ -45,7 +45,7 @@ class DependencyNotice { private function displayMessage(): void { $dependencyErrorMessage = sprintf( // translators: %1$s: WordPress version e.g. 6.7, %2$s: Gutenberg version e.g. 19.3 - __('This email was created using the new editor, but it requires WordPress version %1$s or higher, or the Gutenberg plugin version %2$s or above. Please update your setup to continue editing or preview this email.', 'mailpoet'), + __('This email was created using the new editor, which requires WordPress version %1$s or higher. If you also have the Gutenberg plugin installed, ensure its version is %2$s or above. Please update your setup to continue editing or previewing this email.', 'mailpoet'), Dependency_Check::MIN_WP_VERSION, Dependency_Check::MIN_GUTENBERG_VERSION ); diff --git a/packages/php/email-editor/src/Engine/class-dependency-check.php b/packages/php/email-editor/src/Engine/class-dependency-check.php index 59d305f6f2..146b1161ee 100644 --- a/packages/php/email-editor/src/Engine/class-dependency-check.php +++ b/packages/php/email-editor/src/Engine/class-dependency-check.php @@ -28,7 +28,13 @@ class Dependency_Check { * Checks if all dependencies are met. */ public function are_dependencies_met(): bool { - return $this->is_gutenberg_version_compatible() || $this->is_wp_version_compatible(); + if ( ! $this->is_wp_version_compatible() ) { + return false; + } + if ( is_plugin_active( 'gutenberg/gutenberg.php' ) ) { + return $this->is_gutenberg_version_compatible(); + } + return true; } /** @@ -42,9 +48,8 @@ class Dependency_Check { * Checks if the WordPress version is supported. */ private function is_gutenberg_version_compatible(): bool { - if ( defined( 'GUTENBERG_VERSION' ) ) { - return version_compare( GUTENBERG_VERSION, self::MIN_GUTENBERG_VERSION, '>=' ); - } - return false; + $plugin_data = get_plugin_data( WP_PLUGIN_DIR . '/gutenberg/gutenberg.php', false, false ); + $version = $plugin_data['Version'] ?? '0.0.0'; + return version_compare( $version, self::MIN_GUTENBERG_VERSION, '>=' ); } }