/**
  * Execute the widget
  */
 public function execute()
 {
     $this->header->addCSS('widgets.css', 'mailmotor');
     $this->setColumn('right');
     $this->setPosition(1);
     $this->groupId = BackendMailmotorModel::getDefaultGroupID();
     $this->parse();
     $this->display();
 }
 /**
  * Execute the widget
  *
  * @return	void
  */
 public function execute()
 {
     // add css
     $this->header->addCSS('widgets.css', 'mailmotor');
     // set column
     $this->setColumn('right');
     // set position
     $this->setPosition(1);
     // fetch the default group ID
     $this->groupId = BackendMailmotorModel::getDefaultGroupID();
     // parse
     $this->parse();
     // display
     $this->display();
 }
Exemple #3
0
 /**
  * Unsubscribes an e-mail address from CampaignMonitor and our database
  *
  * @param string $email The emailaddress to unsubscribe.
  * @param string[optional] $groupId The group wherefrom the emailaddress should be unsubscribed.
  * @return bool
  */
 public static function unsubscribe($email, $groupId = null)
 {
     // get objects
     $cm = self::getCM();
     // set group ID
     $groupId = !empty($groupId) ? $groupId : BackendMailmotorModel::getDefaultGroupID();
     // get group CM ID
     $groupCMId = self::getCampaignMonitorID('list', $groupId);
     // group exists
     if (BackendMailmotorModel::existsGroup($groupId)) {
         // unsubscribe the email from this group
         self::getCM()->unsubscribe($email, $groupCMId);
         // set variables
         $subscriber = array();
         $subscriber['status'] = 'unsubscribed';
         $subscriber['unsubscribed_on'] = BackendModel::getUTCDate('Y-m-d H:i:s');
         // unsubscribe the user
         BackendModel::getDB(true)->update('mailmotor_addresses_groups', $subscriber, 'email = ? AND group_id = ?', array($email, $groupId));
         // user unsubscribed
         return true;
     }
     // user not unsubscribed
     return false;
 }