| Project: | Comment notify |
| Version: | 6.x-1.5 |
| Component: | Code |
| Category: | feature request |
| Priority: | normal |
| Assigned: | Unassigned |
| Status: | needs review |
Issue Summary
Sorry if that I marked this as "bug report", it is not so really, but again not really feature request...
Is it possible to have different $keys in drupal_mail functions that happens twice in the code:
function _comment_notify_mailalert($comment) {
// ...
drupal_mail('comment_notify', 'comment_notify_mail', $author->mail, $language, $message);
// ...
drupal_mail('comment_notify', 'comment_notify_mail', $mail, $language, $message);
}I see that one mail is to author of node post and the other one is for the commenter. However they have the same identifier 'comment_notify_mail' and therefore it is not possible to manipulate with each of them separately on hook_mail_alter. There, they having the same $message['id']
I don't see way how to "alter" on only one of them, for instance on one that goes to post author.
To make better picture with example, I have situation where nodes (main post) have "additional authors" that are userreference CCK fields. I want to put their email addresses as CC in $headers array. Of course I don't want CC when there goes mail to commenter. I tried quite some tricks on hook_mail_alter but couldn't get it. On the other hand it was fairly easy once I changed $key, second argument in second drupal_mail call from 'comment_notify_mail' to 'comment_notify_commenter'.
Is there a particular reason why they must have the same name/key?
Also, is there maybe a way to utilize $sent_to[] variable that I am seeing in the same function.
Thanks.
+nk
Comments
#1
Makes sense to me. Can you post this as a patch?
#2
Hi,
thanks for prompt response!
Here is the patch attached.
#3
Thanks. Updating to better status.