[mod] Using placeholders in the Subject line

3rd party code for pl

Moderators: Dragonrider, J_S, Hernol, vancoovur, H2B2, Heritage

[mod] Using placeholders in the Subject line

Postby korondy » 3:00pm, Thu 06 Mar, 2008

Thank you for this awesome software! I like the versatility and LOVE the price :D

Please help me further personalize my emails by allowing Placeholders in the Subject. At present, placeholders appear as "Happy Easter to the [LastName] Family!"
Slipperville
korondy
phplist newbie
 
Posts: 4
Joined: 6:42am, Thu 06 Mar, 2008
Location: Liberty Lake, WA

Postby funkypenguin » 4:52pm, Thu 06 Mar, 2008

Assuming you're using 2.10.5, there are two ways:

The easy (automatic) way

Download and uncompress the attached patch into your PHPList directory, and apply it.

the hard (manual) way

edit admin/sendemaillib.php, look for the following code from line #723 to line #732:
Code: Select all
  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"];
    }


DIRECTLY AFTER this code (on line #733) paste the following:

Code: Select all
    // 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


Now you should be able to use any user attribute variable in the subject line :)
funkypenguin
PL Nut
 
Posts: 24
Joined: 10:09am, Fri 15 Apr, 2005
Location: New Zealand

Postby korondy » 5:30pm, Thu 06 Mar, 2008

Many, many thanks, FP! (Access denied on your website, so I am doing this hard way...)
Slipperville
korondy
phplist newbie
 
Posts: 4
Joined: 6:42am, Thu 06 Mar, 2008
Location: Liberty Lake, WA

Postby funkypenguin » 11:26pm, Thu 06 Mar, 2008

Access should work now. (Sorry if it's too late!) :p
funkypenguin
PL Nut
 
Posts: 24
Joined: 10:09am, Fri 15 Apr, 2005
Location: New Zealand

Postby metroNlevel » 8:56pm, Wed 07 May, 2008

Works great :)

Thanks!

~mandy
metroNlevel
PL Nut
 
Posts: 17
Joined: 3:42am, Wed 07 May, 2008

The Mod is not fool proof

Postby Heritage » 1:27pm, Mon 11 Aug, 2008

I am pretty good with PHPlist and the mod did not work on an install of 2.10.5.

It locks up the send process. Have you submitted this for an official Mod for the next version?
Heritage
Moderator
 
Posts: 148
Joined: 3:25pm, Fri 23 Jun, 2006
Location: 215-885-3700

doesn't work for me :(

Postby Guest » 4:30am, Fri 26 Dec, 2008

Hi!

I tried this with phplist 2.10.8, and it is "processing the queue" forever (the progress bar just keeps going up and down). This is on a test setup with juts 2 subscribers!

I am using PHP 5.2.6 on Dreamhost.

I'm very new to phplist, so any help would be much appreciated!

Thanks!
/Sifaan
Guest
 

Postby deafdavid » 2:39am, Sat 27 Dec, 2008

Suggest you contact David who wrote the program at david (at) funkypenguin (dot) info. You can click his link to his website listed above.
deafdavid
PL Nut
 
Posts: 22
Joined: 5:30pm, Thu 22 Nov, 2007
Location: Washington, DC

Re: [mod] Using placeholders in the Subject line

Postby johanl2 » 7:09pm, Sat 04 Jul, 2009

Hi there,

Is there any information on how to get it work with 2.10.10? I've e-mailed the original programmer but probably he's quiet busy at the moment and isn't answering.

I've tried to get the old code work, but the lines of the code referred to seems to have changed. So I tried to find the same type of code (line 755 to 764) but when the extra bit if code is placed it isn't possible to send e-mails anymore. Trying to send a test-message leeds to the 'error' Message saved, but beneath that line it's blank, so that doesn't seem very good. Hopefully someone has a solution.

Thx very much.
johanl2
phplist newbie
 
Posts: 2
Joined: 6:59pm, Sat 04 Jul, 2009

Re: [mod] Using placeholders in the Subject line

Postby Dragonrider » 7:43pm, Sat 04 Jul, 2009

In phpList 2.10.10 the lines referred to in part one of the modification are on lines 753-762, add the Funky Penguin Mod after that, ie starting at line 763 and this moves the original code down a few lines, save the file and you can send personlised subject line emails with 2.10.10

(You may need to add the send-core fix - item 5 if necessary)

The final code in admin/sendemaillib.php should look like this (from line 753 on)
Code: Select all
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"];
    }
    // 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
My sites:- http://wharfedalefestival.co.uk, http://ilkleygardeners.org.uk, http://emergencyaid.net

If you're really stuck with installing phpList I'm willing to help out for 1/2 hour once in a while via Remote Access. PM me if you're desperate!
Dragonrider
Moderator
 
Posts: 1249
Joined: 6:58am, Sun 02 Jul, 2006
Location: Ilkley

Re: [mod] Using placeholders in the Subject line

Postby johanl2 » 7:18am, Mon 06 Jul, 2009

Thx very much! Problem must have been within the send-core.php file, but this error only showed up after adding the funky penguin mod.
johanl2
phplist newbie
 
Posts: 2
Joined: 6:59pm, Sat 04 Jul, 2009


Return to Add-ons, Contributions, Mods, Plug-ins

Who is online

Users browsing this forum: No registered users and 0 guests