Ejemplo n.º 1
0
 /**
  * @depends test_createUser
  */
 public function testCreateNotification($User)
 {
     $Notification = new Notification();
     $Notification->subject = "test";
     $Notification->body = "such test, many wow";
     $Notification->Author = $User;
     $Notification->setActionUrl("https://www.google.com.au");
     $Notification->addRecipient($User->id, $User->username, $User->contact_email);
     $Notification->addHeader("blah", "thing");
     $Notification->commit();
     $Notification->dispatch();
     $Notification->getRecipients();
     return $Notification;
 }
Ejemplo n.º 2
0
 /**
  * Queue the newsletter for dispatch
  * @since Version 3.10.0
  * @return \Railpage\Newsletters\Weekly
  */
 private function queue()
 {
     $this->Notification->subject = "[News] " . $this->Newsletter->subject;
     $this->Notification->body = $this->html;
     $this->Notification->meta['decoration'] = $this->replacements;
     $this->Notification->addHeader("List-Unsubscribe", "<http://railpage.com.au/unsubscribe?email=##email_encoded##&newsletter=weekly>");
     Debug::LogCLI("Queueing notification for dispatch");
     $this->Notification->commit();
     $this->Newsletter->status = Newsletter::STATUS_SENT;
     Debug::LogCLI("Commiting the newsletter to the database");
     $this->Newsletter->commit();
     /**
      * Update the last sent timestamp
      */
     foreach ($this->user_ids as $user_id) {
         $query = "INSERT INTO nuke_users_flags (user_id, newsletter_weekly_last) VALUES(" . $user_id . ", NOW()) ON DUPLICATE KEY UPDATE newsletter_weekly_last = NOW()";
         $ZendDB->query($query);
     }
     return $this;
 }