statikbe/craft-flexmail 问题修复 & 功能扩展

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

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

statikbe/craft-flexmail

最新稳定版本:5.0.2

Composer 安装命令:

composer require statikbe/craft-flexmail

包简介

Flexmail integration for Craft CMS

README 文档

README

This plugin integrates the Flexmail REST API into Craft CMS. The first version will focus on adding contacts, and assigning preferences & interests.

Requirements

  • Craft CMS 5.0.0 or later

Installation

To install the plugin, follow these instructions:

cd /path/to/project
composer require statikbe/craft-flexmail
./craft  plugin/install flexmail

Settings

The plugin has the following settings:

  • API username (apiUsername)
  • API token (apiToken)
  • Default contact source (defaultSource) (read more about Flexmail sources here)

The default contact source can be set in settings, or you can set in template using a hidden source field.

Usage

By default, a contact in Flexmail has the following fields (API docs):

  • Email (required)
  • First name
  • Last name
  • Language (required)

Basic subscribe form

 <form method="post">
    {{ actionInput('flexmail/contacts/add') }}
    {{ csrfInput() }}
    <div>
        <label for="email">E-mail</label>
        <input type="email" name="email" id="email">
    </div>
    <div>
        <label for="firstName">First name</label>
        <input type="text" name="firstName" id="firstName">
    </div>
    <div>
        <label for="lastName">Last name</label>
        <input type="text" name="lastName" id="lastName">
    </div>
    <input type="submit" value="Subscribe">
</form>

Subscribe form with custom fields

Flexmail custom fields can be added in the fields namespace. For example fields[city], where "city" is the handle of the custom field in Flexmail.

 <form method="post">
    {{ actionInput('flexmail/contacts/add') }}
    {{ csrfInput() }}
    <div>
        <label for="email">E-mail</label>
        <input type="email" name="email" id="email">
    </div>

    <div>
        <label for="custom">Your organisation</label>
        <input type="text" name="fields[organisation]" id="custom">
    </div>
    <input type="submit" value="Subscribe">
</form>

Subscribe form with interests

To segment or add metadata to contacts in Flexmail use interests[].

It's important to note that the values for these need to be the ID of that item in Flexmail.

Note: The older labels[] and preferences[] fields are deprecated as of v3.0.0 and should not be used. Please use interests[] instead.

 <form method="post">
        {{ actionInput('flexmail/contacts/add') }}
        {{ csrfInput() }}
        <div>
            <label for="email">E-mail</label>
            <input type="email" name="email" id="email">
        </div>

        // Interests
        <input type="checkbox" name="interests[]" value="interestId">

        <input type="submit" value="Subscribe">
    </form>

Interests can be imported and refresh from the API through a Utility.

Fields

The plugin includes fields for interests that are defined in your Flexmail account.

The idea here is that you can create an interest for contacts that subscribe from a specific page/product/etc.

This field will use the imported interests.

Helpers

Flexmail uses ID's for most things (sources, labels, preferences) but those ID's are not exposed in the webpages.

You can use these console command to list each of these, they will return all items with their ID and label

flexmail/debug/get-interest
flexmail/debug/get-sources

统计信息

  • 总下载量: 183
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 1
  • 点击次数: 3
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 1
  • Watchers: 6
  • Forks: 0
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2021-11-24

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固