From 21baa5e6784b7ffa3c1516e78e73385affc45e14 Mon Sep 17 00:00:00 2001 From: Halil Beycan <50718965+BeycanDeveloper@users.noreply.github.com> Date: Thu, 4 Apr 2024 12:16:19 +0800 Subject: [PATCH] add hook for pro and lite dependency --- ...ency-payments-for-paid-memberships-pro.php | 20 +++++++++++++------ 1 file changed, 14 insertions(+), 6 deletions(-) diff --git a/cryptocurrency-payments-for-paid-memberships-pro.php b/cryptocurrency-payments-for-paid-memberships-pro.php index 7366b04..b141ab1 100644 --- a/cryptocurrency-payments-for-paid-memberships-pro.php +++ b/cryptocurrency-payments-for-paid-memberships-pro.php @@ -11,7 +11,7 @@ /** * Plugin Name: CryptoPay Gateway for Paid Memberships Pro - * Requires Plugins: paid-memberships-pro + * Requires Plugins: paid-memberships-pro, cryptopay-wc-lite * Version: 1.0.6 * Plugin URI: https://beycanpress.com/cryptopay/ * Description: Adds CryptoPay as a gateway option for Paid Memberships Pro. @@ -24,7 +24,7 @@ * Requires at least: 5.0 * Tested up to: 6.5.0 * Requires PHP: 8.1 -*/ + */ require_once __DIR__ . '/vendor/autoload.php'; @@ -37,6 +37,13 @@ define('PMPRO_CRYPTOPAY_VERSION', '1.0.6'); define('PMPRO_CRYPTOPAY_URL', plugin_dir_url(__FILE__)); +add_filter('wp_plugin_dependencies_slug', function ($slug) { + if ('cryptopay-wc-lite' === $slug && class_exists(Loader::class)) { + $slug = 'cryptopay'; + } + return $slug; +}); + register_activation_hook(PMPRO_CRYPTOPAY_FILE, function (): void { if (class_exists(Loader::class)) { require_once __DIR__ . '/classes/pro/class.pmpro_transaction_model.php'; @@ -100,6 +107,7 @@ function pmpro_cryptopay_check_discount_code(object &$level, ?string $discountCo pmpro_cryptopay_addModels(); add_action('plugins_loaded', function (): void { + pmpro_cryptopay_addModels(); load_plugin_textdomain('pmpro-cryptopay', false, basename(__DIR__) . '/languages'); @@ -140,7 +148,7 @@ function justShowForCryptoPay() { parent.next().hide(); parent.next().next().hide(); } - + if (jQuery('#gateway').val() == 'cryptopay' || jQuery('#gateway').val() == 'cryptopay_lite') { justShowForCryptoPay(); } @@ -164,9 +172,9 @@ function justShowForCryptoPay() { } else { add_action('admin_notices', function (): void { ?> -
' . esc_html__('clicking here', 'pmpro-cryptopay') . ''); ?>
-' . esc_html__('clicking here', 'pmpro-cryptopay') . ''); ?>
+