jethro-pmm
jethro-pmm copied to clipboard
roster coordinators receive multiple emails from the roster_reminder.php script
I have a few roster reminders set up. And in the .ini files I have included multiple roster coordinators. One of those roster coordinators asked me why they receive multiple copies of the roster reminder. The answer is because they receive the roster reminder (with their email address in the to: field) because they are a roster coordinator. And then they received the roster reminder a second time (with their email address in the bcc: field), because they happen to be filling a roster role that week.
Here's a fix using array_diff(array, array) If we include these two lines at line number 279 then it means roster_reminder.php will strip the roster coordinators from the array of BCC email addresses (and it will also remove them from the list of people to whom the reminder was sent - in the confirmation email - which is fine).
$coordinator_emails=explode(",",$roster_coordinator); //turn the $roster_coordinator string into an array $emails = array_diff ($emails , $coordinator_emails); // then remove the components from that array, from the $emails array
PS I still have not re-learned how to submit a pull request. Sorry.
Thanks for the contribution. I don't mind merging a 2-line fix this way :)
Two thoughts:
- In one way, the second email to the co-ordinator is useful in that it hints that they are serving this week not just co-ordinating!
- Since the co-ordinator is sent a summary, they don't necessary need to be sent the actual reminder (unless they are on the roster themselves). We could add an option in the reminder ini file to control this.
Yes after posting it occurred to me that some people may not mind a second 'reminder'. Perhaps having the option is helpful?