I saw the patches for simplenews D5 to implement a username (or if the user was not registered the email-address, without the @domain-part). That's what I need.

I tried to patch it myself according to the existing patches, but no luck so far.

Is there any patch for D6 already or could someone give it a try to *just* implement the username?

It's not about tokens, profiles or any others overhead. Just "name" ...

Any help is highly appreciated!

Ced

Comments

sutharsan’s picture

Status: Active » Closed (won't fix)

Sorry, the answer remains the same. No.
It will be a flexible solution or no solution at all.

cedrix’s picture

Unpersonalized E-Mail is a pain...

So, after taking a look in the code, I want to provide my own patch for personalizing the recipient of the email sent by simplenews.

It replaces all %username to the name of the account (or in case the user is not registered, it takes the email-address, and suppresses the domain name).

If you plan to implement your newsletters on your site, you should finally edit the newsletter-node again and replace %username with "User".

HTH!

Cedrix

--- simplenews.module.orig      2008-06-10 05:46:22.000000000 +0200
+++ simplenews.module   2008-07-04 15:20:53.000000000 +0200
@@ -1431,6 +1432,22 @@
  * newsletter format selection.
  */
 function simplenews_backend_send($message) {
+/* XCONY PATCH */
+  $personaluser = user_load (array('mail' => $message['to']));
+  if ($personaluser) {
+     $personalize = array("%username" => $personaluser->name);
+
+  } else {
+     $emailname=explode('@', $message['to']);
+     $personalize = array("%username" => $emailname[0]);
+  }
+
+  $unpersonalized=$message['body'];
+  $personalized= strtr($unpersonalized, $personalize);
+  $message['body']=$personalized;
+
+
+
   if (module_exists('mimemail')) {
     // Newsletters with format 'plain' will be send by mimemail as plain text.
     // This requires $plaintext = TRUE and $text to contain the plain text body.

I hope sutharsan see's the great demand for this feature. Up until he implements a full-flexible version, take this patch and remain patient.

claudiu.cristea’s picture

Try Views Send. It allows personalization and full recipient list filtering based on Views.