| Anonymous | Login | Signup for a new account | 21-11-09 09:14 GMT |
| Main | My View | View Issues | Change Log | Roadmap | Docs |
| Viewing Issue Simple Details [ Jump to Notes ] | [ View Advanced ] [ Print ] | |||||||||||
| ID | Category | Severity | Reproducibility | Date Submitted | Last Update | |||||||
| 0011733 | [phplist] Message Send Process | feature | always | 01-10-07 07:21 | 21-01-08 18:50 | |||||||
| Reporter | bhugh | View Status | public | |||||||||
| Assigned To | ||||||||||||
| Priority | high | Resolution | open | |||||||||
| Status | new | Product Version | 2.10.5 | |||||||||
| Summary | 0011733: Conditional includes & placeholders, easy hack | |||||||||||
| Description |
I put together a pretty easy way to conditionally include placeholders and other information, depending on whether a certain attribute exists or not. So you can email "Dear Jane," to your subscribers who have entered their first name and "Good day!" to those who haven't. |
|||||||||||
| Additional Information |
sendemaillib.php, about line 315, find foreach ($user_att_values as $att_name => $att_value) { if (eregi("\[".$att_name."\]",$htmlmessage,$regs)) { $htmlmessage = eregi_replace("\[".$att_name."\]",$att_value,$htmlmessage); } and replace with: foreach ($user_att_values as $att_name => $att_value) { //"CONDITIONAL" substitution thing for HTML messages, 9-30-2007 //Works like this, in email body: //[CONDITIONAL Dear [FIRST NAME]|Greetings!] includes "Dear [FIRST NAME]," if [FIRST NAME] exists //or "Greetings!" otherwise //Works for any attribute name, upper case, in brackets [LAST NAME], [ZIP], etc. if (preg_match_all ('/\[CONDITIONAL\|\[' . preg_quote($att_name, '/') . '\]\|(.*?)\|(.*?)\]/si', $htmlmessage,$matches, PREG_SET_ORDER)) { foreach ($matches as $regs) { if ($att_value<>"") { $conditional=$regs[1]; str_replace ( '[' . strtoupper($att_name) .']', $att_value, $conditional); } else { $conditional=$regs[2]; } $htmlmessage = str_replace($regs[0] , $conditional, $htmlmessage); } } if (preg_match_all ('/\[CONDITIONAL\|\[' . preg_quote($att_name, '/') . '\]\|(.*?)\|(.*?)\]/si', $textmessage,$matches, PREG_SET_ORDER)) { foreach ($matches as $regs) { if ($att_value<>"") { $conditional=$regs[1]; str_replace ( '[' . strtoupper($att_name) .']', $att_value, $conditional); } else { $conditional=$regs[2]; } $textmessage = str_replace($regs[0] , $conditional, $textmessage); } } if (eregi("\[".$att_name."\]",$htmlmessage,$regs)) { $htmlmessage = eregi_replace("\[".$att_name."\]",$att_value,$htmlmessage); } |
|||||||||||
| Tags | No tags attached. | |||||||||||
| Attached Files | ||||||||||||
|
|
||||||||||||
Relationships |
||||||
|
||||||
| There are no notes attached to this issue. |
| Mantis 1.1.6[^] Copyright © 2000 - 2008 Mantis Group |