PHPList is an awesome open source mailing list system, whose 30+ feature set includes:
I use PHPList on a number of projects, and it’s a very powerful tool, although like any powerful tool, it can be “high maintenance”.
PHPList allows you to record arbitary details from your users at signup – i.e., their name, surname, favorite TV show, etc. You can then re-use these variables in your mail messages, by placing “placeholders” into the content. For example, “Hi [NAME], how was [TVSHOW] this week?” would translate to “Hi David, how was Heroes last week?”
There’s no built-in way to do this placeholder replacement on the subject line though. Since I have a need for this feature on Inspirational Journal, and somebody recently brought up the question on the forums, I’ve documented my process here.
Assuming you’re using 2.10.5, there are two ways:
Download and uncompress the attached patch into your PHPList directory, and apply it by running:
[bash]patch -p1 < phplist_user_attributes_in_subject_2.10.5.patch[/bash]
Edit admin/sendemaillib.php, look for the following code from line #723 to line #732:
[php]
if (!TEST) {
if ($hash != ‘forwarded’ || !sizeof($forwardedby)) {
$fromname = $cached[$messageid]["fromname"];
$fromemail = $cached[$messageid]["fromemail"];
$subject = $cached[$messageid]["subject"];
} else {
$fromname = ”;
$fromemail = $forwardedby['email'];
$subject = $GLOBALS['strFwd'].’: ‘.$cached[$messageid]["subject"];
}
[/php]
DIRECTLY AFTER this code (on line #733) paste the following:
[php]
// Funky Penguin Mod starts – variable substitution in the subject
if (is_array($user_att_values)) {
foreach ($user_att_values as $att_name => $att_value) {
if (eregi(“\[".$att_name."\]“,$subject,$regs)) {
$subject = eregi_replace(“\[".$att_name."\]“,$att_value,$subject);
}
}
}
// Funky Penguin Mod ends
[/php]
Now you should be able to use any user attribute variable in the subject line ![]()
| Download: | phplist_user_attributes_in_subject_2.10.5.patch.zip |
|---|---|
| Version: | 0.1 |
| Updated: | July 27, 2008 |
| Size: | 0 bytes |
Related posts:
If you enjoy the content, consider subscribing to the feed(s).
Subscribe via RSS
Subscribe via Email
Follow on Twitter
Follow on FriendFeed
Jump to comments