[Domain] and [website] display in one of the email types

Solutions for other advanced phplisters

[Domain] and [website] display in one of the email types

Postby kllw » 8:51pm, Thu 15 Mar, 2007

In my 'change of details' email, I have a signature at the bottom that uses the [domain] and [website] shortcuts. In the sent email, they display as [domain] and [website], rather than as the full domain name and website name, as expected.

1. Only this email does this. The subscribe email displays just fine.
2. I didn't enter them as the shortcuts; I entered them as the full text. The program is converting them.
3. It is also inserting a character I do not see in my config pages; in the signature in the config page, I see "with a Feelin'!" - in the email, the user sees "with a Feelin'/!"

Any suggestions would be gratefully accepted.
kllw
phpLister
 
Posts: 12
Joined: 3:43am, Sat 03 Mar, 2007

Re: [Domain] and [website] display in one of the email types

Postby H2B2 » 9:47pm, Thu 15 Mar, 2007

H2B2
Moderator
 
Posts: 7188
Joined: 1:51am, Wed 15 Mar, 2006

Postby kllw » 12:13am, Fri 16 Mar, 2007

Thanks, I'll check that out.

I have now noted that it's not just the one email, it's all of them.
kllw
phpLister
 
Posts: 12
Joined: 3:43am, Sat 03 Mar, 2007

Postby kllw » 12:25am, Fri 16 Mar, 2007

Cool. Followed the first link, and that appears to have resolved the domain/website issue.

I still don't know why that backslash is in there, but I believe it's to do with the special characters I'm using, the '! piece. I may just have to take that out.
kllw
phpLister
 
Posts: 12
Joined: 3:43am, Sat 03 Mar, 2007

Postby H2B2 » 3:16am, Fri 16 Mar, 2007

Yes, it looks like phplist is "escaping" that character. Which version are you using?
H2B2
Moderator
 
Posts: 7188
Joined: 1:51am, Wed 15 Mar, 2006

Postby kllw » 2:40pm, Fri 16 Mar, 2007

It's version 2.10.4

Removing the ' removes the / as well.
kllw
phpLister
 
Posts: 12
Joined: 3:43am, Sat 03 Mar, 2007

Fix post missing

Postby WebWeaver64 » 5:41pm, Thu 22 Mar, 2007

The post that explains the fix for this is missing. Any idea where it went, or could someone repost the fix?

Thanks!
shari
WebWeaver64
phpList newbie
 
Posts: 1
Joined: 4:35am, Wed 29 Nov, 2006

Postby H2B2 » 5:53pm, Thu 22 Mar, 2007

The fix was posted by IProto on 20 March 2006. You can still find it in the google cache (search for "[DOMAIN] only works on html emails" ):

IProto wrote:Well I had the exact same issue with this just moments ago and I made a semi fix for it. It seems the problem is that when you save a field on the config page it will do a regular expression search for your domain name and replace it with [DOMAIN]. However the developers I guess forgot to put in the code to do the reverse. So I just simply commented out the code to replace it like so on line 63 of configure.php

Code: Select all
\*
  if ($id != "website" && $id != "domain") {
    $value = preg_replace('/'.$domain.'/i','[DOMAIN]', $value);
    $value = preg_replace('/'.$website.'/i','[WEBSITE]', $value);
  }
*\


So far this seems to work for me. You'll need to change any field that currently has [DOMAIN] saved in it to have your domain again. Hope this helps.

EDIT
==============================================


After looking at the code a bit further I noticed a better way to do this. What's happening is when you hit edit to edit a field on the config page it will request that field from the DB but also will swap any instance of [DOMAIN] or [WEBSITE] for 'www.mysite.com'. However when it puts it into the textbox for you to edit it does the reverse by changing 'www.mysite.com' to [DOMAIN].

All this is fine so far, but what's missing is when it saves the field it doesn't do the conversion back again. So using the code below we can get this to work more like it was intended. Also make sure if you used the code above to comment out that one section you undo that.

These are the lines you need to add:

Code: Select all
      $_POST["values"][$id] = preg_replace('/\[DOMAIN\]/i', $domain, $_POST["values"][$id]);
      $_POST["values"][$id] = preg_replace('/\[WEBSITE\]/i', $website, $_POST["values"][$id]);


Add right after the else in this part of configure.php:

Code:
# configure options
reset($default_config);
if (!empty($_REQUEST['save']) && $id) {
  $info = $default_config[$id];
  if (is_array($_POST)) {
    if ($id == "website" || $id == "domain") {
      $_POST["values"][$id] = str_replace("[DOMAIN]","",$_POST["values"][$id]);
      $_POST["values"][$id] = str_replace("[WEBSITE]","",$_POST["values"][$id]);
    }
    if ($_POST["values"][$id] == "" && !$info[3])
      Error("$info[1] " . $GLOBALS['I18N']->get('cannot be empty'));
    else {

      $_POST["values"][$id] = preg_replace('/\[DOMAIN\]/i', $domain, $_POST["values"][$id]);
      $_POST["values"][$id] = preg_replace('/\[WEBSITE\]/i', $website, $_POST["values"][$id]);

      SaveConfig($id,$_POST["values"][$id],0);
      Redirect("configure");
      exit;
    }
  }
}

H2B2
Moderator
 
Posts: 7188
Joined: 1:51am, Wed 15 Mar, 2006


Return to Advanced Answers, Howtos, Tips & Tricks

Who is online

Users browsing this forum: No registered users and 1 guest

cron