diff --git a/client-mu-plugins/goodbids/composer.json b/client-mu-plugins/goodbids/composer.json
index f15397b5b..e0d8eab9a 100644
--- a/client-mu-plugins/goodbids/composer.json
+++ b/client-mu-plugins/goodbids/composer.json
@@ -67,6 +67,7 @@
"wpackagist-plugin/woocommerce": "^8.6",
"wpackagist-plugin/woocommerce-gateway-stripe": "^8.2",
"wpackagist-plugin/woocommerce-services": "^2.5",
+ "wpackagist-plugin/wp-crontrol": "^1.16",
"wpackagist-plugin/zapier": "^1.0",
"wpengine/advanced-custom-fields-pro": "^6.2"
},
diff --git a/client-mu-plugins/goodbids/composer.lock b/client-mu-plugins/goodbids/composer.lock
index c8191f2d2..bd55df5f5 100644
--- a/client-mu-plugins/goodbids/composer.lock
+++ b/client-mu-plugins/goodbids/composer.lock
@@ -4,7 +4,7 @@
"Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies",
"This file is @generated automatically"
],
- "content-hash": "6645bd3fc046ac4a22bd138fab126064",
+ "content-hash": "73c7f35c06e441373a208dba119d7bb0",
"packages": [
{
"name": "composer/installers",
@@ -1427,6 +1427,24 @@
"type": "wordpress-plugin",
"homepage": "https://wordpress.org/plugins/woocommerce-services/"
},
+ {
+ "name": "wpackagist-plugin/wp-crontrol",
+ "version": "1.16.2",
+ "source": {
+ "type": "svn",
+ "url": "https://plugins.svn.wordpress.org/wp-crontrol/",
+ "reference": "tags/1.16.2"
+ },
+ "dist": {
+ "type": "zip",
+ "url": "https://downloads.wordpress.org/plugin/wp-crontrol.1.16.2.zip"
+ },
+ "require": {
+ "composer/installers": "^1.0 || ^2.0"
+ },
+ "type": "wordpress-plugin",
+ "homepage": "https://wordpress.org/plugins/wp-crontrol/"
+ },
{
"name": "wpackagist-plugin/zapier",
"version": "1.0.7",
diff --git a/client-mu-plugins/goodbids/src/assets/css/admin.css b/client-mu-plugins/goodbids/src/assets/css/admin.css
index a7949cfce..4c1ece084 100644
--- a/client-mu-plugins/goodbids/src/assets/css/admin.css
+++ b/client-mu-plugins/goodbids/src/assets/css/admin.css
@@ -135,3 +135,10 @@ tr.separator td {
table.fixed {
position: static !important;
}
+
+.gb-auction-metrics p,
+.gb-auction-debug-info p {
+ display: flex;
+ gap: 1rem;
+ margin-bottom: 0.15rem;
+}
diff --git a/client-mu-plugins/goodbids/src/classes/Auctions/Admin.php b/client-mu-plugins/goodbids/src/classes/Auctions/Admin.php
index e1513227d..f753165db 100644
--- a/client-mu-plugins/goodbids/src/classes/Auctions/Admin.php
+++ b/client-mu-plugins/goodbids/src/classes/Auctions/Admin.php
@@ -91,6 +91,13 @@ public function info_meta_box(): void {
// Display the Auction Metrics.
goodbids()->load_view( 'admin/auctions/metrics.php', compact( 'auction_id' ) );
+
+ if ( is_super_admin() ) {
+ echo '
';
+
+ // Display the Auction Debug Info.
+ goodbids()->load_view( 'admin/auctions/debug.php', compact( 'auction_id' ) );
+ }
}
/**
diff --git a/client-mu-plugins/goodbids/src/classes/Auctions/Auctions.php b/client-mu-plugins/goodbids/src/classes/Auctions/Auctions.php
index df79ed0a2..aa2a3a7e5 100644
--- a/client-mu-plugins/goodbids/src/classes/Auctions/Auctions.php
+++ b/client-mu-plugins/goodbids/src/classes/Auctions/Auctions.php
@@ -69,7 +69,7 @@ class Auctions {
const AUCTION_CLOSE_META_KEY = '_auction_close';
/**
- * @since 1.0.0
+ * @since 1.0.1
* @var string
*/
const CRON_AUCTION_ENDING_SOON_CHECK_HOOK = 'goodbids_auction_ending_soon_event';
@@ -399,7 +399,7 @@ public function get_unclaimed_reward_auction_emails(): array {
/**
* Gets auctions ending in specific timeframe
*
- * @since 1.0.0
+ * @since 1.0.1
*
* @return array
*/
@@ -408,14 +408,12 @@ public function get_ending_soon(): array {
[
'meta_query' => [
[
- 'key' => self::AUCTION_CLOSED_META_KEY,
- 'value' => '0',
- 'compare' => '=',
+ 'key' => self::AUCTION_CLOSED_META_KEY,
+ 'value' => '0',
],
[
- 'key' => self::AUCTION_STARTED_META_KEY,
- 'value' => '1',
- 'compare' => '=',
+ 'key' => self::AUCTION_STARTED_META_KEY,
+ 'value' => '1',
],
],
]
@@ -423,6 +421,8 @@ public function get_ending_soon(): array {
$ending_soon = [];
+ Log::debug( 'Checking ' . count( $live_auctions->posts ) . ' Auctions if they are ending soon' );
+
foreach ( $live_auctions->posts as $auction_id ) {
$auction = $this->get( $auction_id );
if ( $auction->is_ending_soon() ) {
diff --git a/client-mu-plugins/goodbids/src/classes/Auctions/Cron.php b/client-mu-plugins/goodbids/src/classes/Auctions/Cron.php
index 8b53355e7..d4b5d5bf8 100644
--- a/client-mu-plugins/goodbids/src/classes/Auctions/Cron.php
+++ b/client-mu-plugins/goodbids/src/classes/Auctions/Cron.php
@@ -43,36 +43,38 @@ class Cron {
* @since 1.0.0
*/
public function __construct() {
- // Disable Auctions on Main Site.
+ // Disable Cron on Main Site.
if ( is_main_site() ) {
return;
}
// Set up Cron Schedules.
- $this->cron_intervals['30sec'] = [
- 'interval' => 30,
- 'name' => '30sec',
- 'display' => __( 'Every 30 Seconds', 'goodbids' ),
- ];
- $this->cron_intervals['every_minute'] = [
- 'interval' => MINUTE_IN_SECONDS,
- 'name' => 'every_minute',
- 'display' => __( 'Every Minute', 'goodbids' ),
- ];
- $this->cron_intervals['30min'] = [
- 'interval' => 30 * MINUTE_IN_SECONDS,
- 'name' => '30min',
- 'display' => __( 'Once Every 30 Minutes', 'goodbids' ),
- ];
- $this->cron_intervals['hourly'] = [
- 'interval' => HOUR_IN_SECONDS,
- 'name' => 'hourly',
- 'display' => __( 'Once Hourly', 'goodbids' ),
- ];
- $this->cron_intervals['daily'] = [
- 'interval' => DAY_IN_SECONDS,
- 'name' => 'daily',
- 'display' => __( 'Once Daily', 'goodbids' ),
+ $this->cron_intervals = [
+ '30sec' => [
+ 'interval' => 30,
+ 'name' => '30sec',
+ 'display' => __( 'Every 30 Seconds', 'goodbids' ),
+ ],
+ 'every_minute' => [
+ 'interval' => MINUTE_IN_SECONDS,
+ 'name' => 'every_minute',
+ 'display' => __( 'Every Minute', 'goodbids' ),
+ ],
+ '30min' => [
+ 'interval' => 30 * MINUTE_IN_SECONDS,
+ 'name' => '30min',
+ 'display' => __( 'Once Every 30 Minutes', 'goodbids' ),
+ ],
+ 'hourly' => [
+ 'interval' => HOUR_IN_SECONDS,
+ 'name' => 'hourly',
+ 'display' => __( 'Once Hourly', 'goodbids' ),
+ ],
+ 'daily' => [
+ 'interval' => DAY_IN_SECONDS,
+ 'name' => 'daily',
+ 'display' => __( 'Once Daily', 'goodbids' ),
+ ],
];
// Attempt to trigger events for opened/closed auctions.
@@ -90,14 +92,14 @@ public function __construct() {
// Schedule a cron job to remind users to claim their rewards.
$this->schedule_reward_claim_reminder();
+ // Schedule a cron job to check for auctions ending soon.
+ $this->schedule_auction_ending_soon_check();
+
// Use cron action to start auctions.
$this->cron_check_for_starting_auctions();
// Use cron action to close auctions.
$this->cron_check_for_closing_auctions();
-
- // Schedule a cron job to check for auctions ending soon.
- $this->schedule_auction_ending_soon_check();
}
/**
@@ -217,9 +219,12 @@ private function schedule_auction_ending_soon_check(): void {
'init',
function (): void {
if ( wp_next_scheduled( Auctions::CRON_AUCTION_ENDING_SOON_CHECK_HOOK ) ) {
+ Log::debug( 'Auction Ending Soon Cron Check already scheduled' );
return;
}
+ Log::debug( 'Scheduling Auction Ending Soon Cron Check' );
+
// Event is not scheduled, so schedule it.
wp_schedule_event(
strtotime( current_time( 'mysql' ) ),
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 95b0a2199..b2843f37f 100644
--- a/client-mu-plugins/goodbids/src/classes/Plugins/WooCommerce/Emails.php
+++ b/client-mu-plugins/goodbids/src/classes/Plugins/WooCommerce/Emails.php
@@ -106,7 +106,7 @@ public function load_email_classes(): void {
$this->email_classes = [
'AuctionClosed' => new AuctionClosed(),
'AuctionFreeBidUsed' => new AuctionFreeBidUsed(),
- 'AuctionIsEndingSoon' => new AuctionIsEndingSoon(),
+ '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 aef9b8199..8347d5982 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
@@ -2,20 +2,21 @@
/**
* Auction is Ending Soon: Email the Watchers when an Auction is close to closing.
*
- * @since 1.0.0
+ * @since 1.0.1
* @package GoodBids
*/
namespace GoodBids\Plugins\WooCommerce\Emails;
-use GoodBids\Auctions\Auctions as Auctions;
+use GoodBids\Auctions\Auctions;
+use GoodBids\Utilities\Log;
defined( 'ABSPATH' ) || exit;
/**
* Auction Ending Soon Email
*
- * @since 1.0.0
+ * @since 1.0.1
* @extends Email
*/
class AuctionIsEndingSoon extends Email {
@@ -23,7 +24,7 @@ class AuctionIsEndingSoon extends Email {
/**
* Set the unique Email ID
*
- * @since 1.0.0
+ * @since 1.0.1
* @var string
*/
public $id = 'goodbids_auction_ending_soon';
@@ -31,7 +32,7 @@ class AuctionIsEndingSoon extends Email {
/**
* Set email defaults
*
- * @since 1.0.0
+ * @since 1.0.1
*
* @return void
*/
@@ -49,21 +50,26 @@ public function __construct() {
}
/**
- * Trigger this email when an Auction is within 4 hours of closing
+ * Trigger this email when an Auction is within 1/3 of the bidding window closing.
*
- * @since 1.0.0
+ * @since 1.0.1
*
* @return void
*/
private function cron_check_for_auctions_ending_soon(): void {
+ Log::debug( 'Init: Check for Auctions Ending Soon' );
add_action(
Auctions::CRON_AUCTION_ENDING_SOON_CHECK_HOOK,
function (): void {
+ Log::debug( 'Checking for Auctions Ending Soon' );
$auctions = goodbids()->auctions->get_ending_soon();
if ( ! $auctions ) {
+ Log::debug( 'No Auctions Ending Soon found' );
return;
}
+ Log::debug( 'Found ' . count( $auctions ) . ' Auctions Ending Soon' );
+
foreach ( $auctions as $auction_id ) {
$auction = goodbids()->auctions->get( $auction_id );
$this->send_to_bidders( $auction );
@@ -76,7 +82,7 @@ function (): void {
/**
* Get email subject.
*
- * @since 1.0.0
+ * @since 1.0.1
* @return string
*/
public function get_default_subject(): string {
@@ -91,7 +97,7 @@ public function get_default_subject(): string {
/**
* Get email heading.
*
- * @since 1.0.0
+ * @since 1.0.1
* @return string
*/
public function get_default_heading(): string {
@@ -101,7 +107,7 @@ public function get_default_heading(): string {
/**
* Get button text
*
- * @since 1.0.0
+ * @since 1.0.1
* @return string
*/
public function get_default_button_text(): string {
@@ -111,7 +117,7 @@ public function get_default_button_text(): string {
/**
* Set Button URL
*
- * @since 1.0.0
+ * @since 1.0.1
*
* @return string
*/
diff --git a/client-mu-plugins/goodbids/views/admin/auctions/debug.php b/client-mu-plugins/goodbids/views/admin/auctions/debug.php
new file mode 100644
index 000000000..7219b19c9
--- /dev/null
+++ b/client-mu-plugins/goodbids/views/admin/auctions/debug.php
@@ -0,0 +1,30 @@
+
+
+
+
+ auctions->get( $auction_id );
+
+ printf(
+ '
%s%s
',
+ esc_html__( 'Start Triggered', 'goodbids' ),
+ esc_html( $auction->start_triggered() ? __( 'Yes', 'goodbids' ) : __( 'No', 'goodbids' ) )
+ );
+
+ printf(
+ '
%s%s
',
+ esc_html__( 'End Triggered', 'goodbids' ),
+ esc_html( $auction->end_triggered() ? __( 'Yes', 'goodbids' ) : __( 'No', 'goodbids' ) )
+ );
+ ?>
+
diff --git a/client-mu-plugins/goodbids/views/admin/auctions/details.php b/client-mu-plugins/goodbids/views/admin/auctions/details.php
index bf81011c9..65cc906bb 100644
--- a/client-mu-plugins/goodbids/views/admin/auctions/details.php
+++ b/client-mu-plugins/goodbids/views/admin/auctions/details.php
@@ -49,17 +49,20 @@
);
if ( $reward_product ) {
+ $reward_title = $reward_product->get_name();
+ $reward_title = wp_trim_words( $reward_title, 10, '...' );
+
if ( in_array( $auction->get_status(), [ Auction::STATUS_LIVE, Auction::STATUS_CLOSED ] ) && ! is_super_admin() ) {
printf(
'%s
%s
',
esc_html__( 'Reward Product', 'goodbids' ),
- esc_html( $reward_product->get_name() )
+ esc_html( $reward_title )
);
} else {
printf(
'%s
%s (%s)
',
esc_html__( 'Reward Product', 'goodbids' ),
- esc_html( $reward_product->get_name() ),
+ esc_html( $reward_title ),
esc_html( goodbids()->auctions->wizard->get_wizard_url( Wizard::EDIT_MODE_OPTION, $auction_id, $reward_product->get_id() ) ),
esc_html__( 'Edit', 'goodbids' )
);
diff --git a/client-mu-plugins/goodbids/views/admin/auctions/metrics.php b/client-mu-plugins/goodbids/views/admin/auctions/metrics.php
index 2e7fcde4c..ac594ac87 100644
--- a/client-mu-plugins/goodbids/views/admin/auctions/metrics.php
+++ b/client-mu-plugins/goodbids/views/admin/auctions/metrics.php
@@ -17,32 +17,32 @@
%s
%s',
+ '%s%s
',
esc_html__( 'Total Bids', 'goodbids' ),
esc_html( $auction->get_bid_count() )
);
printf(
- '%s
%s
',
+ '%s%s
',
esc_html__( 'Available Free Bids', 'goodbids' ),
esc_html( $auction->get_free_bids_available() )
);
printf(
- '%s
%s
',
+ '%s%s
',
esc_html__( 'Total Extensions', 'goodbids' ),
esc_html( $auction->get_extensions() )
);
printf(
- '%s
%s
',
+ '%s%s
',
esc_html__( 'Total Raised', 'goodbids' ),
wp_kses_post( wc_price( $auction->get_total_raised() ) )
);
if ( $current_bid ) :
printf(
- '%s
%s
',
+ '%s%s
',
esc_html__( 'Current Bid', 'goodbids' ),
wp_kses_post( wc_price( $current_bid->get_price() ) )
);
@@ -51,7 +51,7 @@
if ( $last_bid ) :
$last_bid_amount = $last_bid->get_total( 'edit' );
printf(
- '%s
%s%s
',
+ '%s%s%s
',
esc_html__( 'Last Bid', 'goodbids' ),
esc_url( $last_bid->get_edit_order_url() ),
wp_kses_post( wc_price( $last_bid_amount ) ),