From 7661f5ba9ae3c32d77b32175529ad53e4229ee58 Mon Sep 17 00:00:00 2001 From: Vikas Patil <10000232+patilvikasj@users.noreply.github.com> Date: Thu, 1 Aug 2024 13:01:43 +0530 Subject: [PATCH 1/2] Load plugin only when EDD is active --- class-edd-simple-after-payment-redirect.php | 37 +++++++++++++++++---- package.json | 2 +- readme.txt | 7 ++-- 3 files changed, 36 insertions(+), 10 deletions(-) diff --git a/class-edd-simple-after-payment-redirect.php b/class-edd-simple-after-payment-redirect.php index 511d404..64ea370 100644 --- a/class-edd-simple-after-payment-redirect.php +++ b/class-edd-simple-after-payment-redirect.php @@ -7,7 +7,7 @@ * Author URI: https://pratikchaskar.com/ * Text Domain: edd-simple-after-payment-redirect * Domain Path: /languages - * Version: 1.0.4 + * Version: 1.0.5 * * PHP version 7 * @@ -69,12 +69,35 @@ public static function instance() { * @return void */ private function __construct() { - add_action( 'edd_complete_purchase', array( $this, 'process_standard_payment' ) ); - add_filter( 'edd_payment_confirm_paypal', array( $this, 'process_paypal_standard' ) ); - add_action( 'template_redirect', array( $this, 'process_offsite_payment' ) ); - add_action( 'edd_meta_box_fields', array( $this, 'edd_external_product_render_field' ), 90 ); - add_filter( 'edd_metabox_fields_save', array( $this, 'edd_external_product_save' ) ); - add_filter( 'edd_metabox_save__edd_after_payment_redirect', array( $this, 'edd_external_product_metabox_save' ) ); + add_action( 'plugins_loaded', array( $this, 'maybe_load_plugin' ), 9999, 0 ); + } + + /** + * Load plugin only when EDD is active. + * + * @return void + */ + public function maybe_load_plugin() { + if ( ! class_exists( 'Easy_Digital_Downloads' ) ) { + add_action( + 'admin_notices', + function() { + ?> +
+

+
+ Date: Thu, 1 Aug 2024 13:09:31 +0530 Subject: [PATCH 2/2] Update README.md --- README.md | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 87b9503..9206a77 100644 --- a/README.md +++ b/README.md @@ -3,8 +3,8 @@ **Donate link:** https://www.paypal.me/BrainstormForce **Tags:** edd, payment, redirect **Requires at least:** 4.4 -**Tested up to:** 6.2 -**Stable tag:** 1.0.4 +**Tested up to:** 6.6 +**Stable tag:** 1.0.5 **License:** GPLv2 or later **License URI:** http://www.gnu.org/licenses/gpl-2.0.html @@ -27,6 +27,9 @@ e.g. ## Changelog ## +## 1.0.5 ### +- Fix: Fatal error on front end when Easy digital downloads plugin is not active. + ### 1.0.4 ### - Improvement: Added compatibility to WordPress 6.1