zwo3/newsletter_subscribe 问题修复 & 功能扩展

解决BUG、新增功能、兼容多环境部署,快速响应你的开发需求

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

zwo3/newsletter_subscribe

Composer 安装命令:

composer require zwo3/newsletter_subscribe

包简介

Subscribe / Unsubscribe Extension (e.g. for Newsletter), depends on tt_address

README 文档

README

  • Subcribe and unsubscribe for newsletters for TYPO3 >= 9.5
  • Depends on tt_address
  • Scheduler task to delete unconfirmed subscribers after a while (since v3.1.0)

What does it do?

  • Provides a plugin to double optin subscribe
  • Provides a plugin to double optin unsubscribe
  • Provides field in tt_address to generate unsubscribe link in direct_mail mailings

Breaking in 5.0

  • If you use the default templates and styles you have to add the class form-input to input fields and form-checkbox to the checkboxes. Ther former approach overrode the appearance of every checkbox on pages, where the static template of this extension was included.

Caveats

This extension changes the behaviour of tt_address and disables the soft delete feature which means that deleted records are removed from the database directly instead of being marked as deleted.

This might lead to problems if you already have an existing set of records in the table tt_address.

To mitigate this behaviour you can purge all deleted records from tt_address.
Or you can reenable the original behaviour by adding this code to Configuration/TCA/Overrides/tt_address.php in your sitepackage:

$GLOBALS['TCA']['tt_address']['ctrl']['delete'] = 'deleted';

Removed hard deletion of tt_address records. Because of https://docs.typo3.org/m/typo3/reference-coreapi/main/en-us/ExtensionArchitecture/FileStructure/ExtTablesSql.html#auto-generated-structure the field "delete" wouldn't be generated otherwise. Use Scheduler Task to delete soft-deleted records instead.

Install

  • Install via extension manager or
  • Install via composer
  • Include static template

Configuration

Parameter Description Type, Validation Default
dataProtectionPage Uid of page with information about the data protection policy integer 1
adminEmail Email address in admin notification mails string, email, mandatory admin.name@domain.tld
adminName Name in admin notification mails string Your admin name
senderEmail Email address in confirmation mails string, email, mandatory noreply@domain.tld
senderName Name in confirmation mails string Your sender name
newsletterName Title of the newsletter / subscription list string Newsletter
showFields Additional fields to show in subscription form (gender,firstName,lastName,company).
email and dataProtection are always shown.
string null
subscribePageUid Uid of page with subscription form. Used for links in templates and mails. string null
useSimpleSpamPrevention
(Extension Configuration)
whether there should be a simple spam preventition using javascript and session (with session cookie) bool 1
spamTimeout time in seconds to wait before form gets rendered again if spam check fails int 5
useHCaptcha whether hCaptcha (https://www.hcaptcha.com/) should be used, needs further configuration bool 0
hCaptchaSiteKey hCaptcha site key, only if hCaptcha is used string 10000000-ffff-ffff-ffff-000000000001
hCaptchaSecretKey hCaptcha secret key, only if hCaptcha is used string 0x0000000000000000000000000000000000000000
sendAdminInfo whether the admin should get an info mail on every confirmation bool 0
sendPageNotFoundOnInvalidConfirmation whether a 404 is thrown, when an invilid confirmation link is clicked. Otherwise a hint is shown (already confirmed?). This option is new in 6.1 bool 1
multipleConfirmation allow processing confirmation links without checking if the subscription is already confirmed. This option is new in 7.1.0 bool 1
mailTemplateRootPath path to the mail templates, root for different languages (e.g. en, de, dk) string EXT:newsletter_subscribe/Resources/Private/Templates/Mail/
mailLayoutRootPath path to the mail layouts used from the templates string EXT:core/Resources/Private/Layouts/
overrideFlexformSettingsIfEmpty Fields, which should be overridden from typosrcipt if left blank in the flexform (like in tx_news, thx to Georg Ringer!). string adminEmail, adminName, subscribePageUid, mailTemplateRootPath, dataProtectionPage, adminName, showFields, newsletterName

Site config (for nicer link in subscriber mails)

routeEnhancers:
  Subscribe:
    type: Extbase
    extension: NewsletterSubscribe
    plugin: Subscribe
    routes:
      -
        routePath: '/confirm/create'
        _controller: 'Subscribe::createConfirmation'
      -
        routePath: '/confirm/{confirm}/{uid}'
        _controller: 'Subscribe::doConfirm'
        _arguments:
          confirm: subscriptionHash
          uid: uid
      -
        routePath: '/unsubscribe/{unsubscribe}/{uid}'
        _controller: 'Subscribe::unsubscribe'
        _arguments:
          unsubscribe: subscriptionHash
          uid: uid

Unsubscribe link in direct_mail

  1. First add the field subscription_hash to the fields of direct mail in the extension configuration of direct mail: direct mail configuration
  2. Add the link in your mail template:
    <a href="http://www.domain.tld/page/unsubscribe/###USER_subscription_hash###/###USER_uid###">unsubscribe</a> where this unsubscribe/###USER_subscription_hash###/###USER_uid###" is the important part.
    Note: The subscribe plugin must be inserted on the page "page" in that url.

Salutation in direct_mail

  1. Add 'salutation' field (see above 'subscription_hash')
  2. Add ###USER_salutation### on the page

Scheduler Tasks / Console Commands

There are scheduler tasks / console commands available (TYPO3 v10 only) to fill empty database fields in tt_address:

  • newslettersubscribe:fillsalutation
    Updates the salutation field based on the sys_language_uid and gender fields of the tt_address records. The salutation can be configured via TypoScript.
  • newslettersubscribe:fillsubscriptionhash
    Updates the subscription_hash field. This is especially handy if there are subscriptions added manually in the TYPO3 backend or you have legacy data in tt_address. The subscription_hash is necessary for the unsubscribe link in direct_mail to work.

To do

  • creating ajax submit
  • update documentation

zwo3/newsletter_subscribe 适用场景与选型建议

zwo3/newsletter_subscribe 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 5.03k 次下载、GitHub Stars 达 2, 最近一次更新时间为 2020 年 01 月 13 日, 在 PHP 生态内属于活跃度较高的组件。

它主要适用于以下技术方向: 「newsletter」 「extension」 「typo3」 「subscribe」 「tt_address」 等业务场景。在实际项目中,围绕这些方向常见需要落地的问题包括:接口对接、性能调优、并发安全、与既有框架(Laravel / ThinkPHP / Yii / Webman 等)的兼容适配,以及生产环境的日志埋点与稳定性保障。

我们在过去多个企业项目中使用过 zwo3/newsletter_subscribe 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。

围绕 zwo3/newsletter_subscribe 我们能提供哪些服务?
定制开发 / 二次开发

基于 zwo3/newsletter_subscribe 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。

BUG 修复 & 性能优化

线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。

项目外包 & 长期维护

承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。

yvsm@zunyunkeji.com QQ:316430983 微信:yvsm316 西安尊云信息科技 · 专注 PHP / Go / 分布式系统研发

统计信息

  • 总下载量: 5.03k
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 2
  • 点击次数: 23
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 2
  • Watchers: 5
  • Forks: 7
  • 开发语言: PHP

其他信息

  • 授权协议: GPL-2.0-or-later
  • 更新时间: 2020-01-13