diff --git a/public_html/wp-content/plugins/camptix-attendee-survey/includes/cron.php b/public_html/wp-content/plugins/camptix-attendee-survey/includes/cron.php
index aef4838fe..54c87ef93 100644
--- a/public_html/wp-content/plugins/camptix-attendee-survey/includes/cron.php
+++ b/public_html/wp-content/plugins/camptix-attendee-survey/includes/cron.php
@@ -118,19 +118,20 @@ function is_time_to_send_email( $email_id ) {
return false;
}
+ if ( 'wcpt-closed' !== $wordcamp_post->post_status ) {
+ return false;
+ }
+
$end_date = $wordcamp_post->meta['End Date (YYYY-mm-dd)'][0];
- if ( ! isset( $end_date ) ) {
+ if ( empty( $end_date ) ) {
log( 'WordCamp missing end date', $email_id, $wordcamp_post );
return false;
}
- $date = new \DateTime("@$end_date ");
- $current_date = new \DateTime();
- $interval = $current_date->diff($date);
- $days_difference = $interval->days;
+ $send_date = $end_date + ( DAYS_AFTER_TO_SEND * DAY_IN_SECONDS );
- return DAYS_AFTER_TO_SEND === $days_difference;
+ return gmdate( 'Y-m-d', $send_date ) === current_time( 'Y-m-d', true );
}
/**
diff --git a/public_html/wp-content/plugins/wordcamp-organizer-survey/includes/debrief-survey/cron.php b/public_html/wp-content/plugins/wordcamp-organizer-survey/includes/debrief-survey/cron.php
index 49e95db9f..5eddcaf88 100644
--- a/public_html/wp-content/plugins/wordcamp-organizer-survey/includes/debrief-survey/cron.php
+++ b/public_html/wp-content/plugins/wordcamp-organizer-survey/includes/debrief-survey/cron.php
@@ -124,6 +124,10 @@ function is_time_to_send_email( $email_id ) {
return false;
}
+ if ( 'wcpt-closed' !== $wordcamp_post->post_status ) {
+ return false;
+ }
+
$end_date = $wordcamp_post->meta['End Date (YYYY-mm-dd)'][0];
if ( empty( $end_date ) ) {
@@ -131,12 +135,9 @@ function is_time_to_send_email( $email_id ) {
$end_date = $wordcamp_post->meta['Start Date (YYYY-mm-dd)'][0];
}
- $date = new \DateTime("@$end_date ");
- $current_date = new \DateTime();
- $interval = $current_date->diff($date);
- $days_difference = $interval->days;
+ $send_date = $end_date + ( DAYS_AFTER_TO_SEND * DAY_IN_SECONDS );
- return DAYS_AFTER_TO_SEND === $days_difference;
+ return gmdate( 'Y-m-d', $send_date ) === current_time( 'Y-m-d', true );
}
/**