From 4c7e5477a7837ff36b4952262f1b9590bfe0b8cd Mon Sep 17 00:00:00 2001 From: Steve Sutton Date: Fri, 19 Jan 2018 16:56:57 -0500 Subject: [PATCH] Don't remove the queue just mark it processed. Will have to make more changes now. --- classes/notifications.php | 21 +++++++++++++++++++++ models/admin/ajax/runQueue.php | 2 +- 2 files changed, 22 insertions(+), 1 deletion(-) diff --git a/classes/notifications.php b/classes/notifications.php index fc821d0..b58b5c8 100644 --- a/classes/notifications.php +++ b/classes/notifications.php @@ -405,6 +405,27 @@ class GlmNotifications ); } + /** + * markQueueProcessed + * + * Mark queue row as processed with the current datetime. + * + * @param mixed $queue_id Id for the queue. + * + * @access public + * @return void + */ + public function markQueueProcessed( $queue_id ) + { + $this->wpdb->update( + GLM_MEMBERS_BILLING_PLUGIN_DB_PREFIX . 'notification_queue', + array( 'processed_time' => date( 'Y-m-d' ) ), + array( 'id' => $queue_id ), + array( '%s' ), + array( '%d' ) + ); + } + /** * deleteQueue * diff --git a/models/admin/ajax/runQueue.php b/models/admin/ajax/runQueue.php index d6c2a5c..28e674e 100644 --- a/models/admin/ajax/runQueue.php +++ b/models/admin/ajax/runQueue.php @@ -77,7 +77,7 @@ class GlmMembersAdmin_ajax_runQueue if ( isset( $queued ) && !empty( $queued ) ) { foreach ( $queued as $queue ) { $Notifications->sendEmailNotification( $queue['notification_type'], $queue['account'] ); - $Notifications->deleteQueue( $queue['id'] ); + $Notifications->markQueueProcessed( $queue['id'] ); } } wp_die(); -- 2.17.1