[mod] How to copy a message

3rd party code for phpList

[mod] How to copy a message

Postby mj@ef.dk » 12:13pm, Wed 14 Nov, 2007

How can I make a copy of a message? I am missing a kind of "save as new message" button.

Thanks
Mikkel
mj@ef.dk
phpList newbie
 
Posts: 1
Joined: 12:11pm, Wed 14 Nov, 2007

I have this problem too!

Postby AmandaElizabeth » 1:26am, Fri 16 Nov, 2007

I have a newsletter that goes out onnce a week and a lot of the content stays the same. I'd like to copy it and then make the content changes before sending the new version. Does phplist not allow for this? Seems like a major oversight.
Thanks,
Amanda
AmandaElizabeth
phpList newbie
 
Posts: 4
Joined: 6:02pm, Fri 16 Feb, 2007

Re: I have this problem too!

Postby H2B2 » 1:38am, Fri 16 Nov, 2007

AmandaElizabeth wrote:I have a newsletter that goes out onnce a week and a lot of the content stays the same. I'd like to copy it and then make the content changes before sending the new version.
A message template would typically hold those parts of the HTML message/newsletter that remain unchanged. This is usually fine if the message content doesn't have too many sections that remain unchanged. If you need multiple content areas, you could take a look at the PBTS_XTRA plugin. See http://docs.phplist.com/PhplistHacks
H2B2
Moderator
 
Posts: 7188
Joined: 1:51am, Wed 15 Mar, 2006

message template

Postby AmandaElizabeth » 5:47pm, Mon 19 Nov, 2007

Does the message template save the from line and the subject line and the text and the footer of the email? I am constantly having to retype all those areas every time I send the newsletter out and they stay the same from week to week so I would like to just copy them over or use them from a template - (the text field contains a link to the newsletter online, so that stays the same.)Thanks, Amanda
AmandaElizabeth
phpList newbie
 
Posts: 4
Joined: 6:02pm, Fri 16 Feb, 2007

A patch to do what you need.

Postby rolan » 12:00am, Tue 20 Nov, 2007

I made a small hack to messages.php which adds a new link to copy the contents of a message into a new draft message.

This contribution was sponsored by Amanda at Networking for Professionals (www.networkingforprofessionals.com)


--- ../phplist-2.10.4/lists/admin/messages.php Mon Nov 19 18:22:26 2007
+++ lists/admin/messages.php Mon Nov 19 18:38:40 2007
@@ -82,6 +82,11 @@
print "<hr><br>\n";
}

+if (isset($_GET['duplicate'])) {
+ $result = Sql_query("insert into phplist_message (id,subject,fromfield,tofield,replyto,message,textmessage,footer,entered,modified,embargo,repeatuntil,status,htmlformatted,sendformat,template,owner) select NULL,subject,fromfield,tofield,replyto,message,textmessage,footer,now(),now(),now(),now(),'draft',htmlformatted,sendformat,template,owner from phplist_message where id=".intval($_GET['duplicate']));
+}
+
+
if (isset($_GET['resend'])) {
$resend = sprintf('%d',$_GET['resend']);
# requeue the message in $resend
@@ -98,6 +103,8 @@
print"<br><hr><br><p>\n";
}

+
+
if (isset($_GET['suspend'])) {
$suspend = sprintf('%d',$_GET['suspend']);
print $GLOBALS['I18N']->get('Suspending')." $suspend ..";
@@ -277,7 +284,8 @@
%s<br>
%s<br>
%s
- <a>'.$GLOBALS['I18N']->get("delete").'</a>
+ <a>'.$GLOBALS['I18N']->get("delete").'</a><br>
+ %s
</td>
</tr>',
$status.
@@ -286,7 +294,8 @@
$msg['status'] != 'inprocess' ? PageLink2("messages",$GLOBALS['I18N']->get("Requeue"),"resend=".$msg["id"]) : $totalsent." ".$GLOBALS['I18N']->get("sent"),
$msg["status"] != 'prepared' ? PageLink2("send",$GLOBALS['I18N']->get("Edit"),"id=".$msg["id"]) : PageLink2("preparesend",$GLOBALS['I18N']->get("Edit"),"id=".$msg["id"]),
$clicks[0] && CLICKTRACK ? PageLink2("mclicks",$GLOBALS['I18N']->get("click stats"),"id=".$msg["id"]).'<br>':'',
- PageURL2("messages$url_keep","","delete=".$msg["id"])
+ PageURL2("messages$url_keep","","delete=".$msg["id"]),
+ PageLink2("messages",'Duplicate','type=draft&duplicate='.$msg["id"])
);
}
}
rolan
phpList newbie
 
Posts: 4
Joined: 11:49pm, Mon 19 Nov, 2007

Re: A patch to do what you need.

Postby flug » 8:33pm, Sun 25 Nov, 2007

Nice patch--it's working for me.
Last edited by flug on 2:34am, Mon 26 Nov, 2007, edited 1 time in total.
flug
PL Nut
 
Posts: 25
Joined: 12:17am, Mon 28 Aug, 2006

Re: A patch to do what you need.

Postby flug » 8:36pm, Sun 25 Nov, 2007

rolan wrote:I made a small hack to messages.php which adds a new link to copy the contents of a message into a new draft message.


This looks like an interesting mod.

Here is how you use it:

1. Click on "messages". Find the message you want to re-send.
2. Click on the link "duplicate" to the right of that message.
3. This creates a new draft message that is the same as the previous message, and when the page re-loads you will find yourself in the list of draft messages. Your new draft message should be at the top of the list.
4. To edit & send the message, click the "edit" link on the message--then go in & edit & send as usual.

Note that part of rolan's code was eaten by the forum software. Below is a version that should work right, or you can download the file here:

messages.php.patch

Code: Select all
--- ../phplist-2.10.4/lists/admin/messages.php Mon Nov 19 18:22:26 2007
+++ lists/admin/messages.php Mon Nov 19 18:38:40 2007
@@ -77,6 +77,11 @@
   print "<hr /><br />\n";
 }
 
+if (isset($_GET['duplicate'])) {
+  $result = Sql_query("insert into phplist_message (id,subject,fromfield,tofield,replyto,message,textmessage,footer,entered,modified,embargo,repeatuntil,status,htmlformatted,sendformat,template,owner) select NULL,subject,fromfield,tofield,replyto,message,textmessage,footer,now(),now(),now(),now(),'draft',htmlformatted,sendformat,template,owner from phplist_message where id=".intval($_GET['duplicate']));
+}
+
+
 if (isset($_GET['resend'])) {
   $resend = sprintf('%d',$_GET['resend']);
   # requeue the message in $resend
@@ -93,6 +98,8 @@
   print"<br /><hr /><br /><p>\n";
 }
 
+
+
 if (isset($_GET['suspend'])) {
   $suspend = sprintf('%d',$_GET['suspend']);
   print $GLOBALS['I18N']->get('Suspending')." $suspend ..";
@@ -269,7 +276,8 @@
       %s<br />
       %s<br />
       %s
-      <a href="javascript:deleteRec(\'%s\');">'.$GLOBALS['I18N']->get("delete").'</a>
+      <a href="javascript:deleteRec(\'%s\');">'.$GLOBALS['I18N']->get("delete").'</a><br>
+      %s
       </td>
       </tr>',
       $status.
@@ -278,7 +286,9 @@
       $msg['status'] != 'inprocess' ? PageLink2("messages",$GLOBALS['I18N']->get("Requeue"),"resend=".$msg["id"]) : $totalsent." ".$GLOBALS['I18N']->get("sent"),
       $msg["status"] != 'prepared' ? PageLink2("send",$GLOBALS['I18N']->get("Edit"),"id=".$msg["id"]) : PageLink2("preparesend",$GLOBALS['I18N']->get("Edit"),"id=".$msg["id"]),
       $clicks[0] && CLICKTRACK ? PageLink2("mclicks",$GLOBALS['I18N']->get("click stats"),"id=".$msg["id"]).'<br/>':'',
-      PageURL2("messages$url_keep","","delete=".$msg["id"])
+      PageURL2("messages$url_keep","","delete=".$msg["id"]),
+      PageLink2("messages",'Duplicate','type=draft&duplicate='.$msg["id"])
+
     );
   }
 }
Last edited by flug on 2:40am, Mon 26 Nov, 2007, edited 1 time in total.
flug
PL Nut
 
Posts: 25
Joined: 12:17am, Mon 28 Aug, 2006

Re: A patch to do what you need.

Postby H2B2 » 10:18pm, Sun 25 Nov, 2007

flug wrote:The forum software causes problems with a patch file like rolan posted unless it's posted as "code".

Even with the "code" the software still strips out any references to javascript
You could edit your post, paste the code again, and make sure to select "Disable HTML in this post" on the left
of your editing window. This will ensure that html tags are not truncated.
H2B2
Moderator
 
Posts: 7188
Joined: 1:51am, Wed 15 Mar, 2006

Re: A patch to do what you need.

Postby flug » 2:41am, Mon 26 Nov, 2007

H2B2 wrote:You could edit your post, paste the code again, and make sure to select "Disable HTML in this post" on the left
of your editing window. This will ensure that html tags are not truncated.


Aha, the light dawns. Corrected version above. Thanks!
flug
PL Nut
 
Posts: 25
Joined: 12:17am, Mon 28 Aug, 2006

Postby H2B2 » 4:51pm, Fri 30 Nov, 2007

phpList has a "repetition" feature which you could take a look at: http://docs.phplist.com/Repetition

As I have never used it, I completely forgot about it's existence until I recently stumbled on the above
documentation page. I've included this page in documentation index to make it more accessible.
H2B2
Moderator
 
Posts: 7188
Joined: 1:51am, Wed 15 Mar, 2006

Quick question

Postby sugar » 7:12pm, Thu 10 Apr, 2008

How do you go about installing this patch. Do you have to run it via telnet or something along those lines?

I have a mail list that uses a lot of formatting in the body. My template is set up for the header and the footer, but the content needs to live in a table to provide formatting. If I was doing the sending I would simply copy and paste the code and then make the changes, but it needs to be easy for a non-technical person. My PHP knowledge is limited, enough to be dangerous.

Thanks
sugar
phpList newbie
 
Posts: 1
Joined: 7:07pm, Thu 10 Apr, 2008

Thanks, I was looking for exactly this feature

Postby thdyck » 5:53pm, Thu 14 Aug, 2008

This is exactly a feature that we can use, as we send similar e-mails each time but the changes are not suited to a template approach. It's working fine for us. Perhaps the patch can be added to the codebase?

Regards,
Tim Miller Dyck
Canadian Mennonite magazine
thdyck
phpList newbie
 
Posts: 4
Joined: 5:30am, Sun 06 Jan, 2008

Postby Ernesto » 6:08pm, Thu 14 Aug, 2008

Why use a patch when it is already an implemented feature known as "message repetition" as mentioned
in above post:
H2B2 wrote:phpList has a "repetition" feature which you could take a look at: http://docs.phplist.com/Repetition

As I have never used it, I completely forgot about it's existence until I recently stumbled on the above
documentation page. I've included this page in documentation index to make it more accessible.
Search first, Ask questions later...
Ernesto
PL Freak!
 
Posts: 592
Joined: 2:25am, Thu 08 Jun, 2006

Repetitions vs. ad hoc message duplication and resending

Postby thdyck » 7:38pm, Thu 14 Aug, 2008

Hi Ernesto,

I had previously looked at the repetition feature, but that requires a static message template with either a changing attachment or a section of dynamic content from a web location.

In our case, we are sending out messages where we cut-and-paste text from our magazine table of contents into an e-mail. The text doesn't exist in that form online and isn't an attachment.

Another use case for us is when we mistakenly send out an e-mail with an incorrect link or another typo. The feature allows us to duplicate the mostly correct message, fix the errors, add a note saying why we are resending it, and then send it out again.

The Repetition feature appears to use a schedule for sending messages and so wouldn't fit this ad hoc resending need.

Regards,
Tim
thdyck
phpList newbie
 
Posts: 4
Joined: 5:30am, Sun 06 Jan, 2008

Postby Ernesto » 10:25pm, Thu 14 Aug, 2008

Thanks for clarifying that Tim.

If you want this mod to be included in the main code, it might be a good idea to file a feature request at
www.mantis.phplist.com

I have the impression that members of the development team do no visit the forum very often.
Search first, Ask questions later...
Ernesto
PL Freak!
 
Posts: 592
Joined: 2:25am, Thu 08 Jun, 2006

Next

Return to Contributions: Plug-ins, Add-ons, Mods

Who is online

Users browsing this forum: No registered users and 1 guest

cron