Page 1 of 1

[SOLVED] Placeholders (variables) in Subject 3.x

PostPosted: 1:55pm, Mon 26 Jan, 2015
by mikcheck
TO HAVE WORKING PLACEHOLDERS ALSO IN SUBJECT

FOR PHPLIST 3.x

IN YOUR PHPLIST FOLDER > ADMIN > sendemaillib.php

You'll find code around line 927

AFTER THIS

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"];
    }


PASTE THIS


Code: Select all
   // MODIFICA PER VARIABILE ES: [NOME] IN OGGETTO
    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);
            }
       }
    }
    // FINE MODIFICA


NOW VARIABLES (PLACEHOLDERS) ARE WORKING IN SUBJECT LINE

Re: [SOLVED] Placeholders (variables) in Subject 3.x

PostPosted: 3:32pm, Mon 26 Jan, 2015
by Dragonrider
If this works, remember you'll need to make this edit each time phpList is officially updated.

Sad to say, so far, this does not work for me.

Re: [SOLVED] Placeholders (variables) in Subject 3.x

PostPosted: 11:58am, Sun 01 Feb, 2015
by duncanc
No need to modify the phplist code as there is already a plugin that does exactly this.

See this topic https://forums.phplist.com/viewtopic.php?f=7&t=40137.