Example #1
0
 /**
  * Updates a list with campaignmonitor and in the database. Returns the affected rows
  *
  * @param array $item The new data.
  * @return int
  */
 public static function updateGroup($item)
 {
     // build unsubscribe link for this list
     $unsubscribeLink = SITE_URL . BackendModel::getURLForBlock('Mailmotor', 'unsubscribe', BL::getWorkingLanguage());
     // update the group with CM
     self::getCM()->updateList($item['name'], $unsubscribeLink . '/?group=' . $item['id'] . '&email=[email]', null, null, self::getCampaignMonitorID('list', $item['id']));
     // check if we have a default group set
     if ($item['is_default'] === 'Y' && $item['language'] != '0') {
         // set all defaults to N
         BackendModel::getContainer()->get('database')->update('mailmotor_groups', array('is_default' => 'N', 'language' => null), 'language = ?', array($item['language']));
     }
     // update the group in our database
     return (int) BackendMailmotorModel::updateGroup($item);
 }