From 7cba7bebfedb320083f0f8e8a3ea80df54a64179 Mon Sep 17 00:00:00 2001 From: Steve Sutton Date: Wed, 13 Jun 2018 10:34:33 -0400 Subject: [PATCH] Update the cron task Turning on the Cron Task --- models/admin/ajax/billingFlagExpiredUsers.php | 6 +- models/admin/ajax/billingRunQueue.php | 2 +- models/admin/ajax/billingSetupQueue.php | 4 +- setup/adminHooks.php | 91 +++++++++---------- 4 files changed, 51 insertions(+), 52 deletions(-) diff --git a/models/admin/ajax/billingFlagExpiredUsers.php b/models/admin/ajax/billingFlagExpiredUsers.php index 2fa73f9..0cb1dfe 100644 --- a/models/admin/ajax/billingFlagExpiredUsers.php +++ b/models/admin/ajax/billingFlagExpiredUsers.php @@ -70,11 +70,11 @@ class GlmMembersAdmin_ajax_billingFlagExpiredUsers public function modelAction( $actionData = false ) { - echo '
$actionData: ' . print_r( $actionData, true ) . '
'; + // echo '
$actionData: ' . print_r( $actionData, true ) . '
'; $days_after_expired = $this->config['settings']['days_after_expired']; $current_date = date( 'Y-m-d' ); $restrictedRole = $this->config['contact_role_numb']['LogInContact']; - echo '
$restrictedRole: ' . print_r( $restrictedRole, true ) . '
'; + // echo '
$restrictedRole: ' . print_r( $restrictedRole, true ) . '
'; // 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 '
$member: ' . print_r( $member, true ) . '
'; + // echo '
$member: ' . print_r( $member, true ) . '
'; apply_filters( 'glm_contact_update_user_role_by_ref_dest', '', diff --git a/models/admin/ajax/billingRunQueue.php b/models/admin/ajax/billingRunQueue.php index a53ec13..5d407ab 100644 --- a/models/admin/ajax/billingRunQueue.php +++ b/models/admin/ajax/billingRunQueue.php @@ -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 '
$queued: ' . print_r( $queued, true ) . '
'; + // echo '
$queued: ' . print_r( $queued, true ) . '
'; // return false; if ( isset( $queued ) && !empty( $queued ) ) { foreach ( $queued as $queue ) { diff --git a/models/admin/ajax/billingSetupQueue.php b/models/admin/ajax/billingSetupQueue.php index 76738ce..2293251 100644 --- a/models/admin/ajax/billingSetupQueue.php +++ b/models/admin/ajax/billingSetupQueue.php @@ -78,7 +78,7 @@ class GlmMembersAdmin_ajax_billingSetupQueue $billingSupport = new GlmBillingSupport( $this->wpdb, $this->config ); foreach ( $notifications as $notice ) { - echo '
$notice: ' . print_r( $notice, true ) . '
'; + // echo '
$notice: ' . print_r( $notice, true ) . '
'; 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 '
$accounts: ' . print_r( $accounts, true ) . '
'; + // echo '
$accounts: ' . print_r( $accounts, true ) . '
'; // return false; if ( isset( $accounts ) && is_array( $accounts ) && !empty( $accounts ) ) { foreach ( $accounts as $account ) { diff --git a/setup/adminHooks.php b/setup/adminHooks.php index aa29cd3..470c0d4 100644 --- a/setup/adminHooks.php +++ b/setup/adminHooks.php @@ -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 ); + } +); -- 2.17.1