Hi !
When the category is not included in the subject, all categories and recipients are combined in a general 'All categories combined' category. Thus you lose track of which categories you sent the message.
The following code combines the categories names. For example, 'Category A', 'Category B', 'Category C' categories, if selected, are combined into 'Category A, Category B, Category C'.
It should replace the block of code at line 562 in mass_contact.page.inc.
// If the module is configured to not include the category in the subject,
// combine all users in all categories into a single listing of recpients.
if (!variable_get('mass_contact_category_override', 1)) {
$combined_categories = implode(', ', array_keys($recipient_lists));
$new_recipient_list = array($combined_categories => array());
// Cycle through all the categories adding all the recipients to the one
// list.
foreach ($recipient_lists as $category) {
if (!empty($new_recipient_list[$combined_categories]['recipients'])) {
$new_recipient_list[$combined_categories]['recipients'] = array_merge($new_recipient_list[$combined_categories]['recipients'], $category['recipients']);
}
else {
$new_recipient_list[$combined_categories]['recipients'] = $category['recipients'];
}
}
// Add the subject.
$new_recipient_list[$combined_categories]['subject'] = t('@subject', array('@subject' => $form_state['values']['subject']));
// Set the original list to the new combined, unduplicated list.
$new_recipient_list[$combined_categories]['recipients'] = array_unique($new_recipient_list[$combined_categories]['recipients']);
$recipient_lists = $new_recipient_list;
}
Comments
Comment #1
oadaeh commentedThat is by design and done to fix #359930: Multiple Emails being sent.
If you want me to include your code in this module, create a proper patch. I won't even look at your code until you do.
Also make sure it doesn't break anything else. I am still trying to fix the problems created by including two other patches that were not correctly created, so I'm a lot less likely to include other people's patches at this time.
Comment #2
Anonymous (not verified) commentedHi !
Ok !
Against which branch should I create the patch ? 7.x-1.x-alpha6, 7.x-1.x-dev or HEAD ? Since you have rewritten that part in HEAD , this patch is definitely not usable on HEAD. I can write a patch against HEAD but I am not able to test it correctly since bugs remain in HEAD.
Replacing 'All categories combined' by something like 'Category A, Category B, etc.' should not have side effects because the 'All categories combined' is not used anywhere else. It does not change any logic thus keeping safe efforts made to avoid duplicate mails.
Comment #3
oadaeh commentedRead the page. It's explained there.
That's not a valid reason to give an incorrectly created patch. Bugs remain in 7.x-1.x-alpha6, as well. At this point, the dev version is more stable than the 7.x-1.x-alpha6 version.
Oh, but it does change the logic. And, whether it changes logic or not, it will change the code, which has the potential to introduce bugs, and thus, have side effects.
Comment #4
oadaeh commentedUpdating the Component.
Comment #5
Anonymous (not verified) commentedSorry to have bother you