? og_mandatory_d6port.patch
? og_mandatory_group.module_0.patch
? ogmg-6x-259236-12.patch
? ogmg-mail-fix-304619-1.patch
Index: og_mandatory_group.module
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/og_mandatory_group/og_mandatory_group.module,v
retrieving revision 1.11
diff -u -p -r1.11 og_mandatory_group.module
--- og_mandatory_group.module	5 Sep 2008 01:22:36 -0000	1.11
+++ og_mandatory_group.module	6 Sep 2008 20:49:00 -0000
@@ -83,8 +83,8 @@ function og_mandatory_group_user($op, &$
         $from = variable_get('site_mail', ini_get('sendmail_from'));
 
         $groups = '';
-        if ($edit['og_register']) {
-          $result = db_query(db_rewrite_sql('SELECT n.nid, n.title, o.* FROM {node} n INNER JOIN {og} o ON n.nid = o.nid WHERE n.type IN ('. str_pad('', count(variable_get('og_node_types', array('og'))) * 5 - 1, "'%s',") .') AND n.status = 1 AND o.register = 1'), variable_get('og_node_types', array('og')));
+        if (!empty($edit['og_register'])) {
+          $result = db_query(db_rewrite_sql('SELECT n.nid, n.title, o.* FROM {node} n INNER JOIN {og} o ON n.nid = o.nid WHERE n.type IN ('. str_pad('', count(variable_get('og_node_types', array('og'))) * 5 - 1, "'%s',") .') AND n.status = 1 AND o.og_register = 1'), variable_get('og_node_types', array('og')));
           while ($row = db_fetch_object($result)) {
             if ($edit['og_register'][$row->nid]) {
               switch ($row->og_selective) {
@@ -116,7 +116,9 @@ function og_mandatory_group_user($op, &$
             if (user_access('administer users', user_load(array('uid' => $row->uid)))) {
               $body .= "\n". t('You may manage this user at @url', array('@url' => url("user/$account->uid/edit", array('absolute' => TRUE))));
             }
-            drupal_mail('og_mandatory_group_register', 'notify', $row->mail, $subj, $body, $from);
+            // array of params with the context so the message will be sent properly
+            $params = array('context' => array('subject' => $subj, 'body' => $body));
+            drupal_mail('og_mandatory_group', 'notify', $row->mail, language_default(), $params, $from);
           }
         }
       }
@@ -125,6 +127,15 @@ function og_mandatory_group_user($op, &$
 }
 
 /**
+ * Implementation of hook_mail()
+ */
+function og_mandatory_group_mail($key, &$message, $params) {
+  $context = $params['context'];
+  $message['subject'] = str_replace(array("\r", "\n"), '', $context['subject']);
+  $message['body'] = drupal_html_to_text($context['body']);
+}
+
+/**
  * Implementation of hook_menu
  *
  */
