Hi,
message_notify module is also have the functionality like notifications, And Now used by drupal-commons and drupal-commerce and will be used in GDO. So Its need integration with mailcomment to post comments via mail. I am started working on this.
I have some questions :-
1) function mailcomment_notifications_message_alter() is used to add header, why not mail_alter is used for this. As I am looking for message_notify I was thinking hook_mail_alter() will be good way to add headers and get values (nid, cid etc) from mail.
2) I have create a patch for message_notify to start work with it http://drupal.org/node/1730648#comment-6349032. Now This mail headers will edited in mailcomment module. So I think mail_alter will be good.
3) Mailcomment need some generalization to not stick with notifications. It should work with all email sending module (If that is notifying about an event or if reply is possible).
Attaching a patch (just to start work.).
Thank in advance.
| Comment | File | Size | Author |
|---|---|---|---|
| #4 | mailcomment-message_notify_integration-1730706-4.patch | 5.53 KB | grota |
| message_notify-integration.patch | 1.34 KB | crazyrohila |
Comments
Comment #1
crazyrohila commentedchanging status.
Comment #2
nbchip commentedHi,
This is somehow related issue http://drupal.org/node/1579488
Comment #3
paolomainardi commented@crazyrohila any progress on this ?
Comment #4
grota commentedAttached you'll find a patch, for the integration with message_notify.
The key design issue is that the decision to continue altering or not, and the calculation of the parameters has been offloaded to an alter hook. In other words using the attached path you need to implement something like the following in your module.
Comment #5
danepowell commentedFYI, I may be receiving sponsorship to integrate this into Mail Comment. Please stand by. Thanks to those of you who have already contributed this code.
Comment #6
mrfelton commentedI used the patch from #4 with some success for a drupal commons mailing list module over at https://drupal.org/node/1964510#comment-7718265
Comment #7
danepowell commentedJust for the record - the short answer to 'why use hook_notifications_message_alter()' is 'because that's how we did it in versions 6.x-2.x and (to some extent) 6.x-1.x' :)
The longer answer is that (I think) there is no standard way that entities are embedded in outgoing emails. Notifications does it one way, Message Notify does it another, but either way we need to implement custom code to extract the entity uid / nid / cid / etc... to generate the MC signature. In the long run, it probably makes sense to just use hook_mail_alter for everything, but let's start a separate issue for that: #2061719: Use hook_mail_alter() instead of hook_notifications_message_alter()
I think the way forward here is to finish #1579488: Move Notifications integration into submodule., then work on Message Notify integration based on patches in OP / #4 / #6
Comment #8
danepowell commentedhttp://drupalcode.org/project/mailcomment.git/commit/a9e3ceb
Okay, I committed a basic version of this, along with a basic simpletest. It's still a little hackish and untested. I'd like to clean it up so that the base module provides more of an API that the submodules interface with, rather than having the submodules basically just copy code from one another.
So, the next steps for this are to finish #2061719: Use hook_mail_alter() instead of hook_notifications_message_alter(), and then #2063449: API for submodules.
Comment #9
danepowell commented@crazyrohila - I just checked, and the reason we have to use hook_notifications_message_alter() instead of hook_mail_alter() is because Notifications doesn't embed event/object info (such as the corresponding node id) in the outgoing message.