From 85e1061147dde741a7c8a9fee921d212732980ac Mon Sep 17 00:00:00 2001 From: Jasper Croome Date: Tue, 16 Apr 2024 22:03:03 -0700 Subject: [PATCH 1/2] adding to woo email page --- .../goodbids/src/classes/Plugins/WooCommerce/Emails.php | 2 ++ .../classes/Plugins/WooCommerce/Emails/AuctionIsEndingSoon.php | 2 +- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/client-mu-plugins/goodbids/src/classes/Plugins/WooCommerce/Emails.php b/client-mu-plugins/goodbids/src/classes/Plugins/WooCommerce/Emails.php index 7d735528a..95b0a2199 100644 --- a/client-mu-plugins/goodbids/src/classes/Plugins/WooCommerce/Emails.php +++ b/client-mu-plugins/goodbids/src/classes/Plugins/WooCommerce/Emails.php @@ -10,6 +10,7 @@ use GoodBids\Plugins\WooCommerce\Emails\AuctionClosed; use GoodBids\Plugins\WooCommerce\Emails\AuctionFreeBidUsed; +use GoodBids\Plugins\WooCommerce\Emails\AuctionIsEndingSoon; use GoodBids\Plugins\WooCommerce\Emails\AuctionIsLive; use GoodBids\Plugins\WooCommerce\Emails\AuctionIsLiveAdmin; use GoodBids\Plugins\WooCommerce\Emails\AuctionOutbid; @@ -105,6 +106,7 @@ public function load_email_classes(): void { $this->email_classes = [ 'AuctionClosed' => new AuctionClosed(), 'AuctionFreeBidUsed' => new AuctionFreeBidUsed(), + 'AuctionIsEndingSoon' => new AuctionIsEndingSoon(), 'AuctionIsLive' => new AuctionIsLive(), 'AuctionIsLiveAdmin' => new AuctionIsLiveAdmin(), 'AuctionOutbid' => new AuctionOutbid(), diff --git a/client-mu-plugins/goodbids/src/classes/Plugins/WooCommerce/Emails/AuctionIsEndingSoon.php b/client-mu-plugins/goodbids/src/classes/Plugins/WooCommerce/Emails/AuctionIsEndingSoon.php index 417c647ac..553488f07 100644 --- a/client-mu-plugins/goodbids/src/classes/Plugins/WooCommerce/Emails/AuctionIsEndingSoon.php +++ b/client-mu-plugins/goodbids/src/classes/Plugins/WooCommerce/Emails/AuctionIsEndingSoon.php @@ -1,6 +1,6 @@ Date: Tue, 16 Apr 2024 22:09:54 -0700 Subject: [PATCH 2/2] switching logic for strict eval --- .../goodbids/src/classes/Auctions/Cron.php | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/client-mu-plugins/goodbids/src/classes/Auctions/Cron.php b/client-mu-plugins/goodbids/src/classes/Auctions/Cron.php index af57fd884..0e0631186 100644 --- a/client-mu-plugins/goodbids/src/classes/Auctions/Cron.php +++ b/client-mu-plugins/goodbids/src/classes/Auctions/Cron.php @@ -242,14 +242,14 @@ private function schedule_auction_ending_soon_check(): void { add_action( 'init', function (): void { - if (wp_next_scheduled(Auctions::CRON_AUCTION_ENDING_SOON_CHECK_HOOK)){ - return; + if (false === wp_next_scheduled(Auctions::CRON_AUCTION_ENDING_SOON_CHECK_HOOK)){ + // Event is not scheduled, so schedule it. + wp_schedule_event( + strtotime( current_time( 'mysql') ), + $this->cron_intervals['1hr']['name'], + Auctions::CRON_AUCTION_ENDING_SOON_CHECK_HOOK + ); } - wp_schedule_event( - strtotime( current_time( 'mysql') ), - $this->cron_intervals['1hr']['name'], - Auctions::CRON_AUCTION_ENDING_SOON_CHECK_HOOK - ); } ); }