public function test_group_queries()
 {
     $actions = wc_get_scheduled_actions(array('group' => $this->groups[1], 'per_page' => -1), 'ids');
     $this->assertCount(10, $actions);
     $actions = wc_get_scheduled_actions(array('group' => $this->groups[1], 'hook' => $this->hooks[9], 'per_page' => -1), 'ids');
     $this->assertCount(1, $actions);
 }
Beispiel #2
0
 /**
  * Fired everytime an email is sent, check to make sure that there
  * is a scheduled daily summary email in the queue.
  */
 public function register_action_scheduler_for_daily_summary()
 {
     $items = Follow_Up_Emails::instance()->scheduler->get_items(array('is_sent' => 0, 'email_trigger' => 'Daily Summary'));
     if (empty($items)) {
         // there are no unsent daily_summary emails in the queue
         FUE_Sending_Scheduler::queue_daily_summary_email();
     } else {
         $scheduled = false;
         foreach ($items as $item) {
             $param = array('email_order_id' => $item->id);
             $actions = wc_get_scheduled_actions(array('hook' => 'sfn_followup_emails', 'args' => $param, 'status' => ActionScheduler_Store::STATUS_PENDING));
             if (!empty($actions)) {
                 $scheduled = true;
                 break;
             }
         }
         if (!$scheduled) {
             FUE_Sending_Scheduler::queue_daily_summary_email();
         }
     }
 }