Index: user_register_notify.module
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/user_register_notify/user_register_notify.module,v
retrieving revision 1.1.2.1
diff -u -r1.1.2.1 user_register_notify.module
--- user_register_notify.module	3 Jun 2008 03:18:58 -0000	1.1.2.1
+++ user_register_notify.module	4 Jun 2008 23:18:07 -0000
@@ -22,6 +22,10 @@
       'access' => user_access('administer site configuration')
     );
   }
+  else {
+    define('USER_REGISTER_NOTIFY_SUBJECT', t('Account details for !user_name at !site'));
+    define('USER_REGISTER_NOTIFY_BODY', t('!user_name (!user_view) has created account.\n\n!user_edit'));
+  }
   return $items;
 }
 
@@ -36,6 +40,21 @@
     '#description' => t('If you leave this blank, the site email address, %mailto, will be used.', array('%mailto' => variable_get('site_mail', ini_get('sendmail_from')))),
     '#default_value' => variable_get('user_register_notify_mailto', ''),
   );
+  $form['user_register_notify_subject'] = array(
+    '#type' => 'textfield',
+    '#title' => t('Email Subject'),
+    '#default_value' => variable_get('user_register_notify_subject', USER_REGISTER_NOTIFY_SUBJECT),
+    '#required' => TRUE,
+    '#description' => t('Subject of user registration messages')
+  );
+  $form['user_register_notify_body'] = array(
+    '#type' => 'textarea',
+    '#title' => t('Email Body'),
+    '#default_value' => variable_get('user_register_notify_body', USER_REGISTER_NOTIFY_BODY),
+    '#rows' => 10,
+    '#required' => TRUE,
+    '#description' => t('Customize the body of the user registration notification email.') .' '. t('Available variables are:') .' !user_name, !user_mail, !user_view, !user_edit, !site, !uri, !uri_brief, !date.'
+  );
   return system_settings_form($form);
 }
 
@@ -50,22 +69,22 @@
       // if visitors can create accounts without administrator's approval.
       // In case when accounts must be created with administrator's approval
       // there is already a 'pending approval' e-mail notification.
-      if ($account->uid != 1 && $account->status) {
-        $subject = t('Account details for !username at !site', array('!username' => $account->name, '!site' => variable_get('site_name', 'Drupal')));
-        if (variable_get('user_register_notify_mailto', FALSE) != FALSE) {
-          $to = $from = variable_get('user_register_notify_mailto', 'site_mail');
-        }
-        else {
-          $to = $from = variable_get('site_mail', ini_get('sendmail_from'));
-        }
-
-        drupal_mail(
-          'user-register-notify-admin',
-          $to,
-          $subject,
-          t("!user (!uri) has created account.\n\n!edit-uri", array('!uri' => url("user/$account->uid", NULL, NULL, TRUE), '!user' => $account->name, '!edit-uri' => url("user/$account->uid/edit", NULL, NULL, TRUE))),
-          $from
+      if ($account->uid != 1 && (variable_get('user_register', 1) == 1 ? $account->status : !$account->status)) {
+        $variables = array(
+          '!user_name' => $account->name,
+          '!user_mail' => $account->mail,
+          '!user_view' => url('user/'. $account->uid, NULL, NULL, TRUE),
+          '!user_edit' => url('user/'. $account->uid .'/edit', NULL, NULL, TRUE),
+          '!site' => variable_get('site_name', 'Drupal'),
+          '!uri' => $base_url,
+          '!uri_brief' => substr($base_url, strlen('http://')),
+          '!date' => format_date(time()),
         );
+        $subject = t(variable_get('user_register_notify_subject', USER_REGISTER_NOTIFY_SUBJECT), $variables);
+        $body = t(variable_get('user_register_notify_body',USER_REGISTER_NOTIFY_BODY), $variables);
+        $from = variable_get('site_mail', ini_get('sendmail_from'));
+        $to = variable_get('user_register_notify_mailto', $from);
+        drupal_mail('user-register-notify-admin', $to, $subject, $body, $from, array('Reply-To' => $to));
       }
       break;
   }
