View Issue Details

IDProjectCategoryView StatusLast Update
0006594phplist applicationMessage Send Processpublic02-11-12 17:59
ReporterHubrisSonic 
PrioritynormalSeverityfeatureReproducibilityN/A
Status resolvedResolutionfixed 
Product Version2.10.2 
Target Version4.0.xFixed in Version2.11.7 
Summary0006594: Add Fallback Feature [FirstName,Fallback=Awesome Dude]
DescriptionIn the spirit of the great product CampaignMonitor, I have added a mod to sendemaillib.php

round about line 327, insert this...
(inside the if (is_array($user_att_values)) { braces )

/////////////////CODE STARTS

    while(preg_match_all("/\[[a-zA-Z0-9,]*Fallback=[a-zA-Z ]*\]/i",$htmlmessage,$regs)) {

    foreach($regs[0] as $tag) {

         $tokens = split(",",$tag);
         $fieldname = str_replace("[","",$tokens[0]);
         $fallback = str_replace("]","",substr($tokens[1],9));
         $found = false;
         foreach ($user_att_values as $att_name => $att_value) {
        if(strcasecmp($fieldname, $att_name)==0 && strlen($att_value)){
            $htmlmessage = str_replace($tag,$att_value,$htmlmessage);
            $found = true;
        }
         }
         if(!$found)
        $htmlmessage = str_replace($tag,$fallback,$htmlmessage);
       
       }
   }

    while(preg_match_all("/\[[a-zA-Z0-9,]*Fallback=[a-zA-Z ]*\]/i",$textmessage,$regs)) {

    foreach($regs[0] as $tag) {

         $tokens = split(",",$tag);
         $fieldname = str_replace("[","",$tokens[0]);
         $fallback = str_replace("]","",substr($tokens[1],9));
         $found = false;
         foreach ($user_att_values as $att_name => $att_value) {
        if(strcasecmp($fieldname, $att_name)==0 && strlen($att_value)){
            $textmessage = str_replace($tag,$att_value,$textmessage);
            $found = true;
        }
         }
         if(!$found)
        $textmessage = str_replace($tag,$fallback,$textmessage);
       
       }
   }

///////////////////// CODE ENDS
TagsNo tags attached.

Relationships

related to 0002705 closed PHPList v2.11 release 
related to 0011733 resolvedmichiel Conditional includes & placeholders, easy hack 

Activities

user1822

17-07-07 18:34

  ~0029454

Very nice idea. I would suggest a language independent syntax. f.i.
[PLACEHOLDER(=default)]