From 851efd5194a450b2225b8b9aca5a9723a518edf9 Mon Sep 17 00:00:00 2001 From: Romas Jankauskas Date: Wed, 28 Aug 2024 09:45:50 +0300 Subject: [PATCH] Changed required messages, separated Install and activate to separate notices. --- class-omnisend-paidmembershipsproaddon.php | 24 +++++++++++++++++----- 1 file changed, 19 insertions(+), 5 deletions(-) diff --git a/class-omnisend-paidmembershipsproaddon.php b/class-omnisend-paidmembershipsproaddon.php index 872a905..39af333 100644 --- a/class-omnisend-paidmembershipsproaddon.php +++ b/class-omnisend-paidmembershipsproaddon.php @@ -86,9 +86,16 @@ public static function check_plugin_requirements() { $omnisend_plugin = 'omnisend/class-omnisend-core-bootstrap.php'; - if ( ! file_exists( WP_PLUGIN_DIR . '/' . $omnisend_plugin ) || ! is_plugin_active( $omnisend_plugin ) ) { + if ( ! file_exists( WP_PLUGIN_DIR . '/' . $omnisend_plugin ) ) { deactivate_plugins( $paid_memberships_pro_addon_plugin ); - add_action( 'admin_notices', array( 'Omnisend_PaidMembershipsProAddOn', 'omnisend_notice' ) ); + add_action( 'admin_notices', array( 'Omnisend_PaidMembershipsProAddOn', 'omnisend_is_not_installed_notice' ) ); + + return; + } + + if ( ! is_plugin_active( $omnisend_plugin ) ) { + deactivate_plugins( $paid_memberships_pro_addon_plugin ); + add_action( 'admin_notices', array( 'Omnisend_PaidMembershipsProAddOn', 'omnisend_deactivated_notice' ) ); return; } @@ -114,14 +121,21 @@ public static function check_plugin_requirements() { * Display a notice if Omnisend is not connected. */ public static function omnisend_is_not_connected_notice() { - echo '

' . esc_html__( 'Your Omnisend is not configured properly. Please configure it firstly', 'omnisend-paid-memberships-pro' ) . '

'; + echo '

' . esc_html__( 'Your Omnisend is not configured properly. Please configure it by connecting to your Omnisend account.', 'omnisend-paid-memberships-pro' ) . '' . esc_html__( 'Omnisend plugin.', 'omnisend-paid-memberships-pro' ) . '

'; } /** * Display a notice for the missing Omnisend Plugin. */ - public static function omnisend_notice() { - echo '

' . esc_html__( 'Plugin Omnisend is deactivated. Please install and activate ', 'omnisend-paid-memberships-pro' ) . '' . esc_html__( 'Omnisend plugin.', 'omnisend-paid-memberships-pro' ) . '

'; + public static function omnisend_is_not_installed_notice() { + echo '

' . esc_html__( 'Omnisend plugin is not installed. Please install it and connect to your Omnisend account.', 'omnisend-paid-memberships-pro' ) . '' . esc_html__( 'Omnisend plugin.', 'omnisend-paid-memberships-pro' ) . '

'; + } + + /** + * Display a notice for deactivated Omnisend Plugin. + */ + public static function omnisend_deactivated_notice() { + echo '

' . esc_html__( 'Plugin Omnisend is deactivated. Please activate and connect to your Omnisend account.', 'omnisend-paid-memberships-pro' ) . '' . esc_html__( 'Omnisend plugin.', 'omnisend-paid-memberships-pro' ) . '

'; } /**