예제 #1
0
 public function newsletterUnsubscribe($email = "")
 {
     $db = JFactory::getDbo();
     $user = JFactory::getUser();
     $and = "";
     if (DEFAULT_NEWSLETTER != "") {
         $and .= "AND newsletter_id='" . DEFAULT_NEWSLETTER . "' ";
     }
     if ($user->id) {
         $and .= "AND `user_id` = " . (int) $user->id . " ";
         $email = $user->email;
     }
     if ($and != "") {
         $query = "DELETE FROM " . $this->_table_prefix . "newsletter_subscription " . "WHERE email = " . $db->quote($email) . " " . $and;
         $this->_db->setQuery($query);
         $this->_db->query();
         $redshopMail = new redshopMail();
         $redshopMail->sendNewsletterCancellationMail($email);
     }
     return true;
 }