Update the cron task
authorSteve Sutton <steve@gaslightmedia.com>
Wed, 13 Jun 2018 14:34:33 +0000 (10:34 -0400)
committerSteve Sutton <steve@gaslightmedia.com>
Wed, 13 Jun 2018 14:35:09 +0000 (10:35 -0400)
Turning on the Cron Task

models/admin/ajax/billingFlagExpiredUsers.php
models/admin/ajax/billingRunQueue.php
models/admin/ajax/billingSetupQueue.php
setup/adminHooks.php

index 2fa73f9..0cb1dfe 100644 (file)
@@ -70,11 +70,11 @@ class GlmMembersAdmin_ajax_billingFlagExpiredUsers
     public function modelAction( $actionData = false )
     {
 
-        echo '<pre>$actionData: ' . print_r( $actionData, true ) . '</pre>';
+        // echo '<pre>$actionData: ' . print_r( $actionData, true ) . '</pre>';
         $days_after_expired = $this->config['settings']['days_after_expired'];
         $current_date       = date( 'Y-m-d' );
         $restrictedRole     = $this->config['contact_role_numb']['LogInContact'];
-        echo '<pre>$restrictedRole: ' . print_r( $restrictedRole, true ) . '</pre>';
+        // echo '<pre>$restrictedRole: ' . print_r( $restrictedRole, true ) . '</pre>';
 
         // Update All expired accounts so they can only be in members only not admin.
         // Find all member contacts (by ref_dest) with accounts that are expired.
@@ -89,7 +89,7 @@ class GlmMembersAdmin_ajax_billingFlagExpiredUsers
             );
             if ( isset( $members ) && $members ) {
                 foreach ( $members as $member ) {
-                    echo '<pre>$member: ' . print_r( $member, true ) . '</pre>';
+                    // echo '<pre>$member: ' . print_r( $member, true ) . '</pre>';
                     apply_filters(
                         'glm_contact_update_user_role_by_ref_dest',
                         '',
index a53ec13..5d407ab 100644 (file)
@@ -73,7 +73,7 @@ class GlmMembersAdmin_ajax_billingRunQueue
         $Notifications = new GlmNotifications( $this->wpdb, $this->config );
         // Get the queue and send notices.
         $queued = $Notifications->getQueuedNotifications();
-        echo '<pre>$queued: ' . print_r( $queued, true ) . '</pre>';
+        // echo '<pre>$queued: ' . print_r( $queued, true ) . '</pre>';
         // return false;
         if ( isset( $queued ) && !empty( $queued ) ) {
             foreach ( $queued as $queue ) {
index 76738ce..2293251 100644 (file)
@@ -78,7 +78,7 @@ class GlmMembersAdmin_ajax_billingSetupQueue
         $billingSupport = new GlmBillingSupport( $this->wpdb, $this->config );
 
         foreach ( $notifications as $notice ) {
-            echo '<pre>$notice: ' . print_r( $notice, true ) . '</pre>';
+            // echo '<pre>$notice: ' . print_r( $notice, true ) . '</pre>';
             switch( $notice['send_date_period'] ) {
             case $this->config['send_date_when_numb']['After']:
                 $before = false;
@@ -88,7 +88,7 @@ class GlmMembersAdmin_ajax_billingSetupQueue
                 break;
             }
             $accounts = $billingSupport->getAccountsRenewing( $notice['send_date_number'], $notice['send_date_period'], $before );
-            echo '<pre>$accounts: ' . print_r( $accounts, true ) . '</pre>';
+            // echo '<pre>$accounts: ' . print_r( $accounts, true ) . '</pre>';
             // return false;
             if ( isset( $accounts ) && is_array( $accounts ) && !empty( $accounts ) ) {
                 foreach ( $accounts as $account ) {
index aa29cd3..470c0d4 100644 (file)
@@ -39,61 +39,60 @@ add_filter(
  *
  * Run only once per day. Everyday.
  */
-// add_filter(
-//     'glm_associate_cron_request',
-//     function( $cron_task ){
-//         $new_cron = array(
-//             array(
-//                 'menu'       => 'ajax',
-//                 'action'     => 'billingFlagExpiredUsers',
-//                 'daysOfWeek' => range( 1, 7 ),
-//                 'times'      => array( 5 ),
-//                 //'times'      => range( 0, 23 ),
-//                 'params'     => array()
-//             )
-//         );
-//         return array_merge( $cron_task, $new_cron );
-//     }
-// );
+add_filter(
+    'glm_associate_cron_request',
+    function( $cron_task ){
+        $new_cron = array(
+            array(
+                'menu'       => 'ajax',
+                'action'     => 'billingFlagExpiredUsers',
+                'daysOfWeek' => range( 1, 7 ),
+                'times'      => array( 5 ),
+                'params'     => array()
+            )
+        );
+        return array_merge( $cron_task, $new_cron );
+    }
+);
 
 /**
  * Setup cron task request to run billingSetupQueue
  *
  * Run only once per day. Everyday.
  */
-// add_filter(
-//     'glm_associate_cron_request',
-//     function( $cron_task ) {
-//         $new_cron = array(
-//             array(
-//                 'menu'       => 'ajax',
-//                 'action'     => 'billingSetupQueue',
-//                 'daysOfWeek' => range( 1, 7 ),
-//                 'times'      => array( 3 ),
-//                 'params'     => array()
-//             )
-//         );
-//         return array_merge( $cron_task, $new_cron );
-//     }
-// );
+add_filter(
+    'glm_associate_cron_request',
+    function( $cron_task ) {
+        $new_cron = array(
+            array(
+                'menu'       => 'ajax',
+                'action'     => 'billingSetupQueue',
+                'daysOfWeek' => range( 1, 7 ),
+                'times'      => array( 3 ),
+                'params'     => array()
+            )
+        );
+        return array_merge( $cron_task, $new_cron );
+    }
+);
 
 /**
  * Setup cron task request to run billingRunQueue
  *
  * Run only once per day. Everyday.
  */
-// add_filter(
-//     'glm_associate_cron_request',
-//     function( $cron_task ) {
-//         $new_cron = array(
-//             array(
-//                 'menu'       => 'ajax',
-//                 'action'     => 'billingRunQueue',
-//                 'daysOfWeek' => range( 1, 7 ),
-//                 'times'      => array( 4 ),
-//                 'params'     => array()
-//             )
-//         );
-//         return array_merge( $cron_task, $new_cron );
-//     }
-// );
+add_filter(
+    'glm_associate_cron_request',
+    function( $cron_task ) {
+        $new_cron = array(
+            array(
+                'menu'       => 'ajax',
+                'action'     => 'billingRunQueue',
+                'daysOfWeek' => range( 1, 7 ),
+                'times'      => array( 4 ),
+                'params'     => array()
+            )
+        );
+        return array_merge( $cron_task, $new_cron );
+    }
+);