View Issue Details

IDProjectCategoryView StatusLast Update
0019148phpList 3 applicationInterface - Administratorpublic09-05-18 13:55
Reportersamtuke 
PrioritynormalSeverityminorReproducibilityhave not tried
Status resolvedResolutionfixed 
PlatformLinuxOSFedoraOS Version26
Product Version3.3.1 
Target Version3.3.3Fixed in Version3.3.3 
Summary0019148: Add documentation on subscriber data placeholders in contextual help
DescriptionEdit: Issue summary was updated from: 'Add more placeholders available by default with basic subscriber info'. Reason for update is that this data is already available, just not documented.

The following data is available for all subscribers but not accessible via campaign placeholders:

- Entered
- Last modified
- Number of bounces

Make this data available by default on a new phpList 3 installation via placeholders in campaigns. Preferably use descriptive placeholder names such as:

- [SIGNUP DATE]
- [SUBSCRIPTION LAST MODIFIED DATE]
- [BOUNCES THIS SUBSCRIBER]

The dates in particular are useful for re-confirmation campaigns, e.g. "Remember us? You signed up to receive newsletters on [SIGNUP DATE]", which are common practice on other platforms.
TagsNo tags attached.

Relationships

related to 0019124 resolvedxheni phpList 3 application Change default confirmation email text to include how data will be used 
related to 0019187 resolvedxheni phpList 3 application Add draft campaign for use with invite plugin available in new installations 

Activities

samtuke

28-03-18 17:37

administrator   ~0060194

@michiel How are new default attributes added? Please assign this to Xheni after providing guidance.

michiel

28-03-18 19:01

manager   ~0060195


I don't understand that question in this context. I thought you meant these default attributes

https://resources.phplist.com/assets/start

Those are added here, as plain text files:

https://github.com/phpList/phplist3/tree/master/public_html/lists/admin/data

michiel

28-03-18 19:21

manager   ~0060196

I think we should avoid using spaces in placeholders. I don't think any of the existing ones have spaces. This can caused issues with regex and line wrapping, eg

[SIGNUP
DATE]

won't match, but people will think it does.

So, in general no spaces or other characters (not underscores either, they are even more confusing, as often they look like spaces, but aren't). Also dashes cause loads of trouble.

I would also argue for short tags, which can be explained in the docs

SIGNUPDATE
BOUNCECOUNTER

etc

samtuke

29-03-18 12:39

administrator   ~0060210

@michiel My question would have more accurately been "How are new default placeholders added?". The confusion came from placeholders stemming from attributes, and the data in question (e.g. subscription date) is stored in the system but not strictly speaking an attribute and therefore not available as a placeholder.

To rephrase: what approach would you use to make data such as subscriber creation date available as a placeholder by default in campaign content?

michiel

29-03-18 17:42

manager   ~0060220

"userdata" is populated here:
https://github.com/phpList/phplist3/blob/master/public_html/lists/admin/sendemaillib.php#L84

and the placeholders replaced here:
https://github.com/phpList/phplist3/blob/master/public_html/lists/admin/sendemaillib.php#L449

So, even though the docs probably do not mention them, all "user" fields should work as placeholders.

Try sending a campaign with

[UUID] or [BOUNCECOUNT] and it will be populated.

You can even use the Fallback:

[BOUNCECOUNT%%no emails bounced to your address]

michiel

29-03-18 18:34

manager   ~0060221

is that enough? Basically, if you want to add placeholders, add entries to the "html", "text" or userdata associative arrays, which are automatically used for parsing. Be aware though that this section is called for every subscriber, so it needs to be fast.

samtuke

30-03-18 14:16

administrator   ~0060233

Last edited: 04-04-18 16:01

View 2 revisions

@michiel yes the data I was referring to is already available, just not documented in the contextual help popup which lists the others. Having tested all available phplist_user_user table columns, this is what is currently accessible via placeholders, including real data/format:

ID = 6
EMAIL = sam@phplist.com
CONFIRMED = 1
BLACKLISTED = 0
OPTEDIN = 0
BOUNCECOUNT = 0
ENTERED = 2017-04-07 10:34:22
MODIFIED = 2017-04-07 10:37:02
UNIQID = 42c7d9e466e98a1562722dc36574241d
UUID = 096339c1-8151-406f-995f-7a9c3856821d
HTMLEMAIL = 1
DISABLED = 0

It would be better if the dates were available in a more friendly format; that could either be achieved as you decribe (adding the formatted versions to the array), or (involving more work) adding support for more templating functions within placeholders (e.g. [DATE%f) for formatting dates).

samtuke

30-03-18 14:28

administrator   ~0060234

@michiel In order to add these placeholders to the help text for the campaign composer page, the same query that is used in sendmaillib.php could be executed in the help script (message.php), and then inserted into the array which is used to list the placeholders. That query:

$query = sprintf('select * from %s where email = "%s"', $GLOBALS['tables']['user'], sql_escape($email));

Do you foresee any problems with this approach?

michiel

02-04-18 09:28

manager   ~0060246

For security reasons, we should exclude at least "password", "uuid", "id" and "uniqid"

in fact, we should remove those when building campaigns.

samtuke

04-04-18 16:02

administrator   ~0060290

@michiel password is already not included, but "uuid", "id" and "uniqid" are. I suppose they could be useful in campaigns -- what is the security risk there?

samtuke

04-04-18 16:04

administrator   ~0060291

[DOMAIN] and [WEBSITE] have been tested and I confirm that they already work by default.

The total list of placeholders missing from the contextual help popup on the campaign composer page is currently:

[ID]
[EMAIL]
[CONFIRMED]
[BLACKLISTED]
[OPTEDIN]
[BOUNCECOUNT]
[ENTERED]
[MODIFIED]
[UNIQID]
[UUID]
[HTMLEMAIL]
[DISABLED]
[DOMAIN]
[WEBSITE]

michiel

06-04-18 19:20

manager   ~0060316

Yes, except that for security I would not include UUID and ID.

UNIQID is ok to include as it is sent in every email anyway.

 "disabled" and "optedin" are also fairly sensitive and mostly for internal use, not to be shared with the subscriber.

samtuke

09-04-18 11:35

administrator   ~0060337

Here is the list of placeholders to be added to the contextual help on the campaign composer page then (sensitive items have been removed):

[EMAIL]
[CONFIRMED]
[BLACKLISTED]
[BOUNCECOUNT]
[ENTERED]
[MODIFIED]
[UNIQID]
[HTMLEMAIL]
[DOMAIN]
[WEBSITE]

The help file which handles this text is in the following repo in en/message.php: https://github.com/phpList/phplist-lan-help

xheni

24-04-18 20:10

administrator   ~0060472

PR: https://github.com/phpList/phplist-lan-help/pull/16