From: Steve Sutton Date: Fri, 19 Jan 2018 21:56:57 +0000 (-0500) Subject: Don't remove the queue just mark it processed. X-Git-Tag: v1.0.0^2~174 X-Git-Url: http://cvs2.gaslightmedia.com/gitweb/?a=commitdiff_plain;h=4c7e5477a7837ff36b4952262f1b9590bfe0b8cd;p=WP-Plugins%2Fglm-member-db-billing.git Don't remove the queue just mark it processed. Will have to make more changes now. --- 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();