Skip to content

Commit

Permalink
Merge pull request #2 from RomasJankauskas/main
Browse files Browse the repository at this point in the history
Changed required messages, separated Install and activate to separate…
  • Loading branch information
arnas authored Aug 28, 2024
2 parents d7d05ce + 851efd5 commit dbc483a
Showing 1 changed file with 19 additions and 5 deletions.
24 changes: 19 additions & 5 deletions class-omnisend-paidmembershipsproaddon.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand All @@ -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 '<div class="error"><p>' . esc_html__( 'Your Omnisend is not configured properly. Please configure it firstly', 'omnisend-paid-memberships-pro' ) . '</p></div>';
echo '<div class="error"><p>' . esc_html__( 'Your Omnisend is not configured properly. Please configure it by connecting to your Omnisend account.', 'omnisend-paid-memberships-pro' ) . '<a href="https://wordpress.org/plugins/omnisend/">' . esc_html__( 'Omnisend plugin.', 'omnisend-paid-memberships-pro' ) . '</a></p></div>';
}

/**
* Display a notice for the missing Omnisend Plugin.
*/
public static function omnisend_notice() {
echo '<div class="error"><p>' . esc_html__( 'Plugin Omnisend is deactivated. Please install and activate ', 'omnisend-paid-memberships-pro' ) . '<a href="https://wordpress.org/plugins/omnisend/">' . esc_html__( 'Omnisend plugin.', 'omnisend-paid-memberships-pro' ) . '</a></p></div>';
public static function omnisend_is_not_installed_notice() {
echo '<div class="error"><p>' . esc_html__( 'Omnisend plugin is not installed. Please install it and connect to your Omnisend account.', 'omnisend-paid-memberships-pro' ) . '<a href="https://wordpress.org/plugins/omnisend/">' . esc_html__( 'Omnisend plugin.', 'omnisend-paid-memberships-pro' ) . '</a></p></div>';
}

/**
* Display a notice for deactivated Omnisend Plugin.
*/
public static function omnisend_deactivated_notice() {
echo '<div class="error"><p>' . esc_html__( 'Plugin Omnisend is deactivated. Please activate and connect to your Omnisend account.', 'omnisend-paid-memberships-pro' ) . '<a href="https://wordpress.org/plugins/omnisend/">' . esc_html__( 'Omnisend plugin.', 'omnisend-paid-memberships-pro' ) . '</a></p></div>';
}

/**
Expand Down

0 comments on commit dbc483a

Please sign in to comment.