Substitute the placeholder [FORWARD] with button. [solved]

Solutions for other advanced phplisters

Substitute the placeholder [FORWARD] with button. [solved]

Postby nkmarkgs » 12:21pm, Tue 13 Apr, 2010

In order for this to be accomplished one has to alter the PhpList code and specifically the file sendemaillib.php in the admin folder.

First save the original sendemaillib.php making a backup copy so if anything goes wrong you can go back to it.

After the line (possibly line-number 144):
Code: Select all
  $url = getConfig("forwardurl");$sep = ereg('\?',$url)?'&':'?';

Add these two lines:
Code: Select all
  $html["messageid"] = sprintf('%d',$messageid);
  $text["messageid"] = sprintf('%d',$messageid);

This is done because a Placeholder is needed for the message id which although it is in the code of phplist the developers haven't made a placeholder for it. So, that's the way to create the placeholder for the message id.

After the above addition to the code the Placeholder for the message id is this: [MESSAGEID]

List of all original PhpList Placeholders is here: http://docs.phplist.com/Placeholders

Then for having a button (image) in the message or template one can use a code such as the following:
Code: Select all
<div style="margin: 0px; text-align: right;">
<a href="http://www.domain.gr/phplist/?p=forward&amp;uid=[USERID]&amp;mid=[MESSAGEID]"><img src="http://www.domain.gr/images/forward-mail.jpg" border="0"></a>
</div>


Joy, Love & Peace, Nikos
http://www.humanitysteam.gr
http://www.humanitysteam.org
nkmarkgs
phpLister
 
Posts: 9
Joined: 4:09pm, Tue 30 Mar, 2010

Re: Substitute the placeholder [FORWARD] with button. [solved]

Postby gilbertoluperon » 2:06pm, Fri 14 May, 2010

Good morning nkmarkgs...

Thanks for this easy to use post of instructions to use a "Button" and I have followed your instructions perfectly. However, I am not able to make it work. The end of the "Button" link comes up as "mid=" whereas the end of the [FORWARD] link comes up as "mid=59" but I can not see what I might have done wrong. I am using the very latest version of PHPList. Have I maybe missed something?
gilbertoluperon
phpList newbie
 
Posts: 1
Joined: 2:01pm, Fri 14 May, 2010

Re: Substitute the placeholder [FORWARD] with button. [solved]

Postby nkmarkgs » 9:07pm, Fri 14 May, 2010

Hi gilbertoluperon,

First let me say that I'm not an expert in PHP nor I know perfectly the workings of Phplist. I just looked for the placeholders searching the code and I just created another new one ...

From what you say it looks like you didn't create the placeholder [MESSAGEID] in the file sendemaillib.php.

I suggest you go through the steps again and follow them exactly and see if you missed something.

First check the code of the file sendemaillib.php, see if the two extra lines of code are actually there and see if you replaced it on the server.

Regards, Nikos
nkmarkgs
phpLister
 
Posts: 9
Joined: 4:09pm, Tue 30 Mar, 2010

Re: Substitute the placeholder [FORWARD] with button. [solved]

Postby lindsayt930 » 10:44pm, Fri 27 Aug, 2010

Yeah Nikos, I'm not able to get it working either and I can see I added those two lines to sendemaillib.php.

Is there something else you did to the file that you left out of the directions?
lindsayt930
phpLister
 
Posts: 5
Joined: 4:29am, Wed 15 Jul, 2009
Location: San Francisco

Re: Substitute the placeholder [FORWARD] with button. [solve

Postby oginome » 7:23pm, Tue 26 Apr, 2011

This patch should solved this issue perfectly.

http://mantis.phplist.com/view.php?id=14406

Code: Select all
# This patch file was generated by NetBeans IDE
# This patch can be applied using context Tools: Apply Diff Patch action on respective folder.
# It uses platform neutral UTF-8 encoding.
# Above lines and this line are ignored by the patching process.
Index: phplist/public_html/lists/admin/sendemaillib.php
--- phplist/public_html/lists/admin/sendemaillib.php Base (1.42)
+++ phplist/public_html/lists/admin/sendemaillib.php Locally Modified (Based On 1.42)
@@ -161,6 +161,8 @@
   $url = getConfig("forwardurl");$sep = ereg('\?',$url)?'&':'?';
   $html["forward"] = sprintf('<a href="%s%suid=%s&mid=%d">%s</a>',$url,$sep,$hash,$messageid,$strThisLink);
   $text["forward"] = sprintf('%s%suid=%s&mid=%d',$url,$sep,$hash,$messageid);
+  $html["messageid"] = sprintf('%d',$messageid);
+  $text["messageid"] = sprintf('%d',$messageid);
   $html["forwardurl"] = sprintf('%s%suid=%s&mid=%d',$url,$sep,$hash,$messageid);
   $text["forwardurl"] = $text["forward"];
   $url = getConfig("public_baseurl");
@@ -317,6 +319,8 @@
     $html['footer'] = $text['footer'];
   }
 
+  $text["footer"] = eregi_replace("\[MESSAGEID\]",$text["messageid"],$text['footer']);
+  $html["footer"] = eregi_replace("\[MESSAGEID\]",$html["messageid"],$html['footer']);
   $text["footer"] = eregi_replace("\[SUBSCRIBE\]",$text["subscribe"],$text['footer']);
   $html["footer"] = eregi_replace("\[SUBSCRIBE\]",$html["subscribe"],$html['footer']);
   $text["footer"] = eregi_replace("\[PREFERENCES\]",$text["preferences"],$text["footer"]);
oginome
phpList newbie
 
Posts: 2
Joined: 7:18pm, Tue 26 Apr, 2011

Re: Substitute the placeholder [FORWARD] with button. [solve

Postby sendma » 6:43pm, Sat 27 Aug, 2011

Hi,how are u friends!!?

i did the same procedure as mentioned before but still not solved my problem :cry:

impossible to use the tag [MESSAGEID]

help me please :wink:
sendma
phpList newbie
 
Posts: 1
Joined: 6:36pm, Sat 27 Aug, 2011

Re: Substitute the placeholder [FORWARD] with button. [solve

Postby joeyvmason » 1:40am, Tue 01 Nov, 2011

I know this is a little bit late, but the patch provided above only allows the messageid to be used as a placeholder in the footer. NOT in the body... Does anyone know how to make the placeholder usable in both the footer AND the body?
joeyvmason
phpLister
 
Posts: 7
Joined: 11:49pm, Mon 26 Sep, 2011

Re: Substitute the placeholder [FORWARD] with button. [solve

Postby joeyvmason » 1:51am, Tue 01 Nov, 2011

Actually, it looks like I just solved the problem.

Replace the following text (roughly line 260)"

foreach (array("forwardform","subscribe","preferences","unsubscribe", 'blacklist') as $item) { #BUGFIX 0015303, 1/2
if (eregi('\['.$item.'\]',$htmlmessage,$regs)) {
$htmlmessage = eregi_replace('\['.$item.'\]',$html[$item],$htmlmessage);
unset($html[$item]); //ASK: Why was this done? It breaks placeholders in the footer
}
if (eregi('\['.$item.'\]',$textmessage,$regs)) {
$textmessage = eregi_replace('\['.$item.'\]',$text[$item],$textmessage);
unset($text[$item]);
}
}



with:

foreach (array("forwardform","subscribe","preferences","unsubscribe", 'blacklist', 'messageid') as $item) { #BUGFIX 0015303, 1/2
if (eregi('\['.$item.'\]',$htmlmessage,$regs)) {
$htmlmessage = eregi_replace('\['.$item.'\]',$html[$item],$htmlmessage);
// unset($html[$item]); //ASK: Why was this done? It breaks placeholders in the footer
}
if (eregi('\['.$item.'\]',$textmessage,$regs)) {
$textmessage = eregi_replace('\['.$item.'\]',$text[$item],$textmessage);
// unset($text[$item]);
}
}
joeyvmason
phpLister
 
Posts: 7
Joined: 11:49pm, Mon 26 Sep, 2011

Re: Substitute the placeholder [FORWARD] with button. [solve

Postby ITCons » 10:44am, Mon 14 Nov, 2011

Hello all
the thread is quite old, but I would still like to post my solution to the problem. Here is what I changed:

nano admin/sendemaillib.php # or your preferred editor

line 144: add after forwardurl:

$html["messageid"] = sprintf('%d',$messageid);
$text["messageid"] = sprintf('%d',$messageid);

line 255: add "messageid" variable to the for-statement. This is for replacing the message-id variable in the textmessage-body. Do the same for footer/template etc accordingly:

Replace this line

foreach (array("forward","forwardurl","subscribeurl","preferencesurl","unsubscribeurl",'blacklisturl') as $item)

with this line

foreach (array("forward","forwardurl","subscribeurl","preferencesurl","unsubscribeurl",'blacklisturl',"messageid") as $item)

now the messageid should show if you include the [MESSAGEID]-Tag in your newsbody.

Oh yes, could this be included in the tunk so on the next release the variable is usable? How to do this? Please advice.

# ASC Software - IT&Services
# Technical Support
ITCons
phpList newbie
 
Posts: 4
Joined: 4:53pm, Sat 21 Nov, 2009


Return to Advanced Answers, Howtos, Tips & Tricks

Who is online

Users browsing this forum: No registered users and 1 guest

cron