Index: og2list.module =================================================================== RCS file: /cvs/drupal/contributions/modules/og2list/og2list.module,v retrieving revision 1.106 diff -u -r1.106 og2list.module --- og2list.module 7 May 2007 11:54:05 -0000 1.106 +++ og2list.module 23 Jul 2007 08:44:51 -0000 @@ -252,22 +252,39 @@ $form['address']['#description'] = t('The mailing list is currently disabled.'); } - $form['mail_type'] = array('#type' => 'radios', - '#title' => t('Group messages'), - '#default_value' => $user->og_groups[(int)arg(2)]['mail_type'], - '#options' => array(0 => t('web only'), 1 => t('individual mail'), OG2LIST_OUTGOING_DIGEST => t('digest')), - '#description' => t('Do you want to receive mails from this group? You can chose between one mail per post or receive them batched once per day.'), - '#weight' => 1); - $form['op']['#weight'] = 10; - } - else { - unset($form['mail_type'], $form['op']); - $form['not_defined'] = array( - '#type' => 'item', - '#title' => t('Mail address'), - '#value' => t('n/a'), - '#description' => t('No mailing list has been created for this group.'), - '#weight' => 2); + $form['from-address'] = array( + '#type' => 'item', + '#title' => t('From-Address for messages'), + '#value' => theme('placeholder', $user->mail), + '#description' => t('You must use the e-mail address shown here to send messages. If your e-mails to the list bounce, make sure you are sending them from this address!'), + '#weight' => 0); + + $mailType = $user->og_groups[(int)arg(2)]['mail_type']; + if (is_null($mailType)) { + $mailType = 1; // defaults to individual mail + } + $submit = TRUE; + switch ($user->og_email) { + case NULL: + case OG_NOTIFICATION_SELECTIVE: + $form['mail_type'] = array('#type' => 'radios', '#title' => t('Group E-Mail Messages'),'#default_value' => $mailType, '#options' => array(0 => t('web only'), 1 => t('individual mail'), OG2LIST_OUTGOING_DIGEST => t('digest')), + '#description' => t('Do you want to receive emails from this group and its mailing list? You can chose between one mail per post or receive them batched once per day.'), '#weight' => 1); + $submit = TRUE; + break; + + case OG_NOTIFICATION_ALWAYS: + $form['mail_type'] = array('#type' => 'item', '#title' => t('Group E-Mail Messages'), '#value' => t('Your !prof is configured to: Always receive email notifications. You will receive new posts and mailing list e-mails from this group as they are created.', array('!prof' => l(t('personal profile'), "user/$user->uid/edit")))); + break; + + case OG_NOTIFICATION_NEVER: + $form['mail_type'] = array('#type' => 'item', '#title' => t('Group E-Mail Message'), '#value' => t('Your !prof is configured to: Never receive email notifications. You will not receive new posts or mailing list e-mails from this group by e-mail.', array('!prof' => l(t('personal profile'), "user/$user->uid/edit")))); + break; + } + + if ($submit) { + $form['op'] = array('#type' => 'submit', '#value' => t('Submit'), '#weight' => 10); + } + $form['gid'] = array('#type' => 'value', '#value' => $node->nid); } } } @@ -1220,7 +1237,7 @@ '#type' => 'item', '#title' => t('Mail address'), '#value' => theme('placeholder', $node->og2list_ml .'@'. variable_get('og2list_domain', $_SERVER['SERVER_NAME'])), - '#description' => t('You can send mail to the group by writing mail this address.'), + '#description' => t('You can send a message to the list by e-mailing the list address as shown above. Replying to list messages will post your reply as a comment under the message you reply to. To turn list e-mails on or off, click "My Subscription" in the group menu and change the "Group messages" setting.'), '#weight' => 0); if ($node->og2list_ml_status && $node->og2list_ml_moderate == 0) { $form['address']['#description'] .= ' '. t('The mailing list is currently enabled and not moderated.'); @@ -1231,6 +1248,14 @@ else if (!$node->og2list_ml_status) { $form['address']['#description'] = t('The mailing list is currently disabled.'); } + + $form['from-address'] = array( + '#type' => 'item', + '#title' => t('From-Address for messages'), + '#value' => theme('placeholder', $user->mail), + '#description' => t('You must use the e-mail address shown here to send messages. If your e-mails to the list bounce, make sure you are sending them from this address!'), + '#weight' => 0); + $form['og2list_ml_status'] = array( '#type' => 'radios', '#title' => t('Mailing list'), Index: mail-out.pl =================================================================== RCS file: /cvs/drupal/contributions/modules/og2list/mail-out.pl,v retrieving revision 1.37 diff -u -r1.37 mail-out.pl --- mail-out.pl 3 Nov 2006 08:39:15 -0000 1.37 +++ mail-out.pl 23 Jul 2007 08:44:51 -0000 @@ -160,7 +160,9 @@ INSERT INTO og2list_outgoing_recipients (mid, nid, recipient_name, recipient_address, timestamp, status) SELECT ?, ?, u.name AS recipient_name, u.mail AS recipient_address, ?, IF(ou.mail_type = 7, 7, 1) -FROM og_uid ou INNER JOIN users u ON ou.uid = u.uid WHERE ((ou.mail_type = 1 AND u.uid != ?) OR ou.mail_type = 7) AND ou.nid = ? AND u.status > 0 AND ou.is_active >= 1 +FROM og_uid ou INNER JOIN users u ON ou.uid = u.uid LEFT OUTER JOIN og_uid_global oug ON ou.uid = oug.uid +WHERE ((u.uid != ? OR ou.mail_type = 7) AND ((oug.og_email IS NULL AND ou.mail_type IN (1,7)) OR (oug.og_email=1) OR (oug.og_email=2 AND ou.mail_type IN (1,7)))) + AND ou.nid = ? AND u.status > 0 AND ou.is_active >= 1 EOF $get_rcpt_stmt=<