phplist

NOTE:: Before reporting an issue, make sure you are running the latest version, currently 3.3.1


View Issue Details Jump to Notes ] Print ]
IDProjectCategoryView StatusDate SubmittedLast Update
0006594phplist applicationMessage Send Processpublic11-06-06 07:1702-11-12 17:59
ReporterHubrisSonic 
PrioritynormalSeverityfeatureReproducibilityN/A
StatusresolvedResolutionfixed 
PlatformOSOS Version
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.
Attached Files

- Relationships Relation Graph ] Dependency Graph ]
related to 0002705closed PHPList v2.11 release 
related to 0011733resolvedmichiel Conditional includes & placeholders, easy hack 

-  Notes
(0029454)
user1822
17-07-07 19:34

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


Copyright © 2000 - 2017 MantisBT Team
Powered by Mantis Bugtracker