DEPRECATION WARNING

This documentation is not using the current rendering mechanism and is probably outdated. The extension maintainer should switch to the new system. Details on how to use the rendering mechanism can be found here.

EXT: Newsletter Subscription Module

Author:Kasper Skårhøj
Created:2002-11-01T00:32:00
Changed by:Donald Duck
Changed:2003-02-11T13:42:04
Author:Kasper Skårhøj
Email:kasper@typo3.com
Info 3:
Info 4:

EXT: Newsletter Subscription Module

Extension Key: da_newsletter_subscription

Copyright 2003, Kasper Skårhøj, <kasper@typo3.com>

This document is published under the Open Content License

available from http://www.opencontent.org/opl.shtml

The content of this document is related to TYPO3

- a GNU/GPL CMS/Framework available from www.typo3.com

Sponsored by

Headline, Denmark

Table of Contents

EXT: Newsletter Subscription Module 1

Introduction 1

What does it do? 1

Screenshots 1

Users manual 2

Creating a subscription form 2

Getting the list of subscribers 6

Adminstration 17

Allowing backend users to create newsletter categories 17

Allowing backend users to extract subscribers lists 17

TSconfig for the backend module 17

Configuration 18

CSS selectors 18

Reference 19

Introduction

What does it do?

A newsletter subscription module which allows you to create any number of categories and then allow frontend users or non-users to check off which categories they want to receive. From the backend you can download a CSV list of recipients for sending the mails in any application you like.

This plugin is easily added to a page as a content element of the plugin-type. The only other thing you need is to create one or more categories to subscribe to.

This plugin allows "dual-mode subscription" which means that the subscribers are either front-end users with a valid login or visitors without a login or a combination if you like so.

Screenshots

This is an example of how the subscription form could look with three categories and a name field:

img-1

Of course the styles of the form can be totally different since it's all controlled by CSS selectors.

Users manual

Creating a subscription form

First you should create a page where the subscription to the newsletters should take place. On that page, put a content element with the type "Insert Plugin" and select the "Newsletter Subscription Management" plugin-type:

img-2

(If you cannot select the Newsletter Subscription Management plugin type contact your administrator. Either this extension is not installed or your permissions do not allow you to select it.)

If you set the Startingpoint newsletter categories will be selected from that page instead. With the recursive option you can select how deep in the page tree from this point that the selection should take place. Thus you can display newsletter categories from multiple pages on a single page.

Adding additional fields to the form

When a user subscribes to the newsletter you might already know things like his name or email address since a login user is required! But if you need to collect further information you can add additional fields to the subscription form. For that purpose you can enter FORM- configuration code into the field User Information Form. Use the formwizard if you like.

img-3

Clicking the wizard button will bring you this interface for adding, deleting and moving the form fields around. Dont use the types for fileupload, hidden value and submit button. They make no sense in this context.

img-4

Creating categories

Now, create some categories on the page where the plugin is inserted:

img-5 You can enter a description for each.

Basically thatis it! On the webpage you should now see something like this:

img-6

The actual look depends fully on your specific website. This is just an example.

Using the subscription form

Notice that the above screenshot shows no form for entering data or selecting newsletters! You will have to log in first (as the message in the bottom states as well). If you think you need to tell this louder and clearer to your visitors, just add another content element on the page explaining any detail you like about the newsletter subscription.

img-7

So after a successful login the newsletter form will look like this:

img-8

Getting the list of subscribers

There is a special made backend module available for extracting the list of subscribers to your newsletters:

img-9

Click this module and you'll see this screen to the right in the backend:

img-10

In this case there are three pages listed under "Newsletter categories". These pages are shown here because each of them contains one or more newsletter categories and so may contain subscribers.

Simply click one of the pages:

img-11

Now you see the categories on the page listed. In this case there were three categories. For each one there are a number of subscribers. That count is noted in the right column.

If you click the [list]-link you will get a simple list of email addresses of the subscribers to the newsletter. That might look something like this:

img-12

You can simply copy-paste these email addresses into your personal email client (eg. Outlook Express) for sending a newsletter. Alternatively you can paste them into the "Quick Mail" part of the Direct Mail module.

A better method

There is a more advanced approach where you can make very precise selections of subscribers. First select the menu item "Subscriber list" in the function menu:

img-13

In the screen you can select subscribers based on which list(s) their are or are not subscribed to (1). Further you can select subscribers based on their user data or email address (3). You can even select subscribers based on criteria from the ad-hoc form with user data entered during subscription (4). In both cases criterias can be combined by AND or OR clauses (5). For the output (6) you can also select which information to list in the CSV-list by checking of the fields you want (2).

Combining subscribers across newsletters

The first thing you'll have to do in the process of getting a list of subscribers is to make a combination of the newsletters. You have the following options:

img-14

The actual selection is explained just beneath the selectors, so the best thing you can do basically is to experiment a little on your own. Notice how this works on this picture:

img-15

So by these selections you will get all subscribers from the "Powertools" as long as they are also represented either "Foor news" or "News movies".

Here is another example:

img-16

Now subscribers must have subscribed to both "Food news" and "Powertools" categories. However if the user is also subscribed to "News movies" he will be excluded from the selection.

By default all subscribers to any newsletter will be selected if none of the selector boxes are set. That would yield the same result as if you set all selectors to "OR subscribed..."

Selecting on user data

Not only can you select subscribers based on their selection of newsletters. You can also limit the result set based on information in their user-records (fe_users) if they are logged in. If you have non- users in you subscription list you can only select on the email address. (By default you can only select on the email address anyways!)

This is the options for selection:

img-17

The selection is done by the SQL-query. The string matching is case- insensitive and the less than/greater than options will also work for strings, since MySQL supports this.

Example 1

Take a look at this example:

img-18

Here all users that has a username starting with "b" or higher is selected OR a zipcode between 1200 and 1300 (inclusive) OR if the last part of the email does NOT match "@typo3.com" (notice how this is inversed by the "NOT" flag!)

You can simply see the query below, so if you understand SQL it's easy to follow what happens. Notice how the query for non-users is limited to selecting on the email-address!

The "Method" is set to "or" in this case. The default is "and".

TIP: By default you'll only see the "Email" field available in this form. If you want to add more fields, please ask your administrator to do that. There is a description for that in the administrator section of this manual.

Example 2

Here is another example:

img-19

So the username must start with a letter higher or equal to "b" but be less than "kat..." - in this case the username "kasper" passes. The zipcode can be anything, but the email address must be set - that is different from a blank value.

And in this case we "and" the clauses together so all must be true for a subscriber to be selected.

Now, the main point with all this was to show the "Show"-flag set in the right column; Every of these fields are selected and you will see that in the CSV list in the result-box in the bottom:

img-20 More about that later.

Selecting based on the local user data

The newsletter subscription has a great feature which is to allow ad- hoc fields in the subscription form. Because you can add any number of fields of any kind you cannot see them in the TYPO3 backend as usual. They are stored internally in the subscription database table. But you can extract them and select on them as with user data fields like username etc.

img-21

In this example we select all subscribers that has entered a name which contains the string "kasper" (whether upper, lower or mixed case - that doesn't matter). Further the subscriber must have either brown or blond hair color. And they must NOT like pizza! (The NOT flag is set)

In the result we will see the name, hair color and pizza-flag included:

img-22

Notice: The clause "less than" and "greater than" cannot select on strings in this case! It will work only with integers or double values.

Output format

There are two formats to choose from at this time:

img-23

"Simple email list" will produce a result like this:

img-24

If you set the flag "Guarantee unique email addresses" you will see no duplicates:

img-25

The more advanced format - which can be imported into a spreadsheet like Excel - is the CSV list:

img-26

If you set the "Download result as file" and press the button again you'll be able to store the result as a file:

img-27

img-28

You can open the file in a spreadsheet. This is how OpenOffice Calc handles the import process:

img-29

... and the result after clicking OK is:

img-30

Storing and loading presets

Most likely you want to do the same extract of subscribers again and again. For instance you want to mail a weekly letter to all subscribers of "Powertools" and "Food news" who lives in zip-code from 1200-1400. So you set up these criteria:

img-31

After having set the criteria, store the settings by entering a name in the bottom of the page and press "Save current query as:".

After that you will see the preset in the preset box and you can load it again next time. Just select it and press "Load preset":

img-32

Adminstration

Allowing backend users to create newsletter categories

If you want your backend users to be able to create newsletter categories you will have to modify a backend usergroup to allow this. In that case, just follow these steps:

Create a backend user group, enable "Include Access Lists" (or modify existing).

Add the table "Newsletter category" to the "Modify tables" list:

img-33

Add the exclude-fields you want the user to access:

img-34 Finally make sure the users supposed to create categories are members of this group.

Allowing backend users to extract subscribers lists

In order to get the list of subscribers from a newsletter a backend user must have access to the "Newsletter subscribers" module. This is done by selecting the module for either the user or one of his member- groups:

img-35

TSconfig for the backend module

There are a number of options you can set for the backend module through PAGE and USER TSconfig. These are listed in this table:

fe_users_fieldList

Property

fe_users_fieldList

Data type

list of strings

Description

A list of fe_users fields to list in the backend for selection. The fields cound be from this list. Fields can only be listed once:

username,name,address,zip,city,telephone

The field, "email" is mandatory.

Default

[page:mod.web_txdanewslettersubscriptionM1; beuser:mod.web_txdanewslettersubscriptionM1]

((generated))
Example

Setting this list of fields in PAGE TSconfig...

mod.web_txdanewslettersubscriptionM1.fe_users_fieldList = username, email, zip

img-36

will yield this result in the module:

img-37

Configuration

There is not much configuration to do for this plugin except setting the CSS styles for the display of categories and the form fields. It's mostly in the hands of the users.

The most basic think you need to do is to add the static-file template to the template record of the website where this plugin is supposed to be used. That is done by editing the template record of your site:

img-38

CSS selectors

For the newsletter extension there is a list of selectors for CSS styling of the list:

DIV.tx-danewslettersubscription-pi1 {}
DIV.tx-danewslettersubscription-pi1 P.tx-danewslettersubscription-pi1-premsg {}
DIV.tx-danewslettersubscription-pi1 DIV.tx-danewslettersubscription-pi1-listrow {}
DIV.tx-danewslettersubscription-pi1 DIV.tx-danewslettersubscription-pi1-listrow TABLE {}
DIV.tx-danewslettersubscription-pi1 DIV.tx-danewslettersubscription-pi1-listrow TABLE TR.tx-danewslettersubscription-pi1-listrow-header {}
DIV.tx-danewslettersubscription-pi1 DIV.tx-danewslettersubscription-pi1-listrow TABLE TR.tx-danewslettersubscription-pi1-listrow-header TD P {}
DIV.tx-danewslettersubscription-pi1 DIV.tx-danewslettersubscription-pi1-listrow TABLE TR.tx-danewslettersubscription-pi1-listrow-header TD P INPUT {}
DIV.tx-danewslettersubscription-pi1 DIV.tx-danewslettersubscription-pi1-listrow TABLE TR {}
DIV.tx-danewslettersubscription-pi1 DIV.tx-danewslettersubscription-pi1-listrow TABLE TR.tx-danewslettersubscription-pi1-listrow-header TD {}
DIV.tx-danewslettersubscription-pi1 DIV.tx-danewslettersubscription-pi1-listrow TABLE TR TD.tx-danewslettersubscription-pi1-descr {}
DIV.tx-danewslettersubscription-pi1 DIV.tx-danewslettersubscription-pi1-listrow TABLE TR TD.tx-danewslettersubscription-pi1-descr P {}
DIV.tx-danewslettersubscription-pi1 TABLE {}
DIV.tx-danewslettersubscription-pi1 TABLE TR.tx-danewslettersubscription-pi1-form-row {}
DIV.tx-danewslettersubscription-pi1 TABLE TR.tx-danewslettersubscription-pi1-form-row TD {}
DIV.tx-danewslettersubscription-pi1 TABLE TR.tx-danewslettersubscription-pi1-form-row TD P INPUT {}
DIV.tx-danewslettersubscription-pi1 TABLE TR.tx-danewslettersubscription-pi1-form-row TD P SELECT {}
DIV.tx-danewslettersubscription-pi1 TABLE TR.tx-danewslettersubscription-pi1-form-row TD P {}
DIV.tx-danewslettersubscription-pi1 TABLE TR.tx-danewslettersubscription-pi1-form-row TD.tx-danewslettersubscription-pi1-form-header P {}
DIV.tx-danewslettersubscription-pi1 TABLE TR.tx-danewslettersubscription-pi1-form-row TD.tx-danewslettersubscription-pi1-form-header {}
DIV.tx-danewslettersubscription-pi1 TABLE TR.tx-danewslettersubscription-pi1-form-row TD P TEXTAREA {}
DIV.tx-danewslettersubscription-pi1 INPUT {}

The selectors for the form fields and labels can be changed through TypoScript configuration of the plugin.

Reference

The TypoScript configuration follows the normal conventions for modern plugins. Thus these properties are all children of "plugin.tx_danewslettersubscription_pi1". For now, use the TypoScript object browser since all properties are preset there.

sorting_field

Property

sorting_field

Data type

string

Description

Allows you to set a sorting field for the listing of news categories.

Allows values from the list;

sorting,starttime,endtime,uid,crdate,title,description

Default

sorting

sorting_desc

Property

sorting_desc

Data type

boolean

Description

If set, sorting is in descending order

Default

0

mode

Property

mode

Data type

string

Description

Defines the mode. Can be set to blank, "dual" or "login".

The default means that people will have to enter their email address. They will receive an email with a link back to the site which will allow them to subscribe or edit subscription.

If "login" then the subscription works for login users only.

If "dual" then it uses both.

Default

mode.noAuthEmail

Property

mode.noAuthEmail

Data type

int

Description

Default is 0 (zero)

1:

If set non-subscribed users are NOT sent an email but directly guided to the subscription form. Thus there is NOT safety for users submitted correct email addresses or their own address for that sake.

However if a user is already subscribed he will receive an email with a link to the page.

2:

Like 1, but where the editing of an existing profile does not require login either.

Default

mode.sendNotificationWhenEmailMode

Property

mode.sendNotificationWhenEmailMode

Data type

boolean

Description

If set an email is sent when subscribed and unsubscribed.

Default

1

[tsref:plugin.tx_danewslettersubscription_pi1]

img-39 EXT: Newsletter Subscription Module - 19