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


PHP Subscriber::sendActivationMail方法代码示例

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


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

示例1: addRecipient

 /**
  * Add a new recipient
  */
 protected function addRecipient()
 {
     global $objPage;
     $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['SUBSCRIBE_ERROR'] = $GLOBALS['TL_LANG']['ERR']['noChannels'];
         $this->reload();
     }
     $email = \Idna::encodeEmail($this->Input->post('email', true));
     $subscriber = new Subscriber($email);
     $arrSub = $subscriber->getActiveSubscriptionIds();
     // Get new subscriptions
     $arrNew = array_diff($arrChannels, $arrSub);
     // Return if there are no new subscriptions
     if (!is_array($arrNew) || count($arrNew) < 1) {
         $_SESSION['SUBSCRIBE_ERROR'] = $GLOBALS['TL_LANG']['ERR']['subscribed'];
         $this->redirect($this->generateFrontendUrl($objPage->row()) . '#' . $this->strFormId);
     }
     // Remove old subscriptions that have not been activated yet
     $subscriber->dropInactiveSubscriptions();
     $time = time();
     $strToken = md5(uniqid(mt_rand(), true));
     // check if additional input fields are required for this channel
     $objChannel = $this->Database->execute("SELECT * FROM tl_newsletter_channel WHERE id IN(" . implode(',', array_map('intval', $arrNew)) . ")");
     $addPlusFields = false;
     $channelInfo = array();
     while ($objChannel->next()) {
         $check = deserialize($objChannel->subscribeplus_inputs);
         if (is_array($check) && count($check) > 0) {
             $addPlusFields = true;
         }
         $channelInfo[$objChannel->id] = $objChannel->row();
     }
     foreach ($arrNew as $cid) {
         $subscriber->tstamp = $time;
         $subscriber->pid = $cid;
         $subscriber->addedOn = $time;
         $subscriber->ip = $this->anonymizeIp($this->Environment->ip);
         $subscriber->token = $strToken;
         $subscriber->active = '';
         $subscriber->registered = $time;
         if ($addPlusFields) {
             foreach ($GLOBALS['TL_DCA']['tl_subscribe_plus']['fields'] as $name => $form) {
                 $subscriber->{$name} = $this->Input->post($name) ? $this->Input->post($name) : '';
             }
         }
         // Add new subscriptions
         $subscriber->add();
         if (array_key_exists($cid, $channelInfo)) {
             if ($channelInfo[$cid]['cleverreach_active'] == 1) {
                 $subscriber->addToCR();
             }
         }
     }
     // 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()));
         }
     }
     // Activation e-mail
     if ($subscriber->sendActivationMail($objChannel->fetchEach('id'))) {
         $this->redirect($this->generateFrontendUrl($objPage->row()) . '#' . $this->strFormId);
     }
 }
开发者ID:heimrichhannot,项目名称:contao-newsletter_plus,代码行数:72,代码来源:ModuleSubscribePlus.php


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