当前位置: 首页>>代码示例>>PHP>>正文


PHP Subscriber::removeFromCR方法代码示例

本文整理汇总了PHP中Subscriber::removeFromCR方法的典型用法代码示例。如果您正苦于以下问题:PHP Subscriber::removeFromCR方法的具体用法?PHP Subscriber::removeFromCR怎么用?PHP Subscriber::removeFromCR使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Subscriber的用法示例。


在下文中一共展示了Subscriber::removeFromCR方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: removeRecipient

 /**
  * Add a new recipient
  */
 protected function removeRecipient()
 {
     $arrChannels = $this->Input->post('channels');
     $arrChannels = array_intersect($arrChannels, $this->nl_channels);
     // see #3240
     // Check the selection
     if (!is_array($arrChannels) || count($arrChannels) < 1) {
         $_SESSION['UNSUBSCRIBE_ERROR'] = $GLOBALS['TL_LANG']['ERR']['noChannels'];
         $this->reload();
     }
     $arrSubscriptions = array();
     $email = \Idna::encodeEmail($this->Input->post('email', true));
     $subscriber = new Subscriber($email);
     // Get active subscriptions
     $objSubscription = $this->Database->prepare("SELECT pid FROM tl_newsletter_recipients WHERE email=? AND active=1")->execute($email);
     if ($objSubscription->numRows) {
         $arrSubscriptions = $objSubscription->fetchEach('pid');
     }
     $arrRemove = array_intersect($arrChannels, $arrSubscriptions);
     // Return if there are no subscriptions to remove
     if (!is_array($arrRemove) || count($arrRemove) < 1) {
         $_SESSION['UNSUBSCRIBE_ERROR'] = $GLOBALS['TL_LANG']['ERR']['unsubscribed'];
         $this->reload();
     }
     // check for cleverreach support
     $objChannel = $this->Database->execute("SELECT id FROM tl_newsletter_channel WHERE cleverreach_active = 1 AND id IN(" . implode(',', array_map('intval', $arrRemove)) . ")");
     // TODO: multiple channel unsubscription
     $subscriber->getByChannel($arrRemove[0]);
     // Remove subscriptions
     $subscriber->remove($arrRemove);
     // optional Cleverreach Deletion
     if ($objChannel->numRows > 0) {
         $subscriber->removeFromCR($objChannel->fetchEach('id'));
     }
     // Get channels
     $objChannels = $this->Database->execute("SELECT title FROM tl_newsletter_channel WHERE id IN(" . implode(',', array_map('intval', $arrRemove)) . ")");
     $arrChannels = $objChannels->fetchEach('title');
     // HOOK: post unsubscribe callback
     if (isset($GLOBALS['TL_HOOKS']['removeRecipient']) && is_array($GLOBALS['TL_HOOKS']['removeRecipient'])) {
         foreach ($GLOBALS['TL_HOOKS']['removeRecipient'] as $callback) {
             $this->import($callback[0]);
             $this->{$callback}[0]->{$callback}[1]($varInput, $arrRemove);
         }
     }
     global $objPage;
     // Redirect to jumpTo page
     if (strlen($this->jumpTo) && $this->jumpTo != $objPage->id) {
         $objNextPage = $this->Database->prepare("SELECT id, alias FROM tl_page WHERE id=?")->limit(1)->execute($this->jumpTo);
         if ($objNextPage->numRows) {
             $this->redirect($this->generateFrontendUrl($objNextPage->fetchAssoc()));
         }
     }
     if ($subscriber->sendUnSubscribeMail($arrRemove)) {
         $this->reload();
     }
 }
开发者ID:heimrichhannot,项目名称:contao-newsletter_plus,代码行数:59,代码来源:ModuleUnsubscribePlus.php


注:本文中的Subscriber::removeFromCR方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。