The hook_prepare should be used as describe in:
http://api.drupal.org/api/function/hook_prepare/6
Nevertheless in mimemail.module we find that it is define for a totaly diferent purpose and that cause (at least in my Drupal installation) a namespace conflict becouse everytime a node is being presented to edit/create, this hook is going to be called. I must say that in my case i use the API the module mime mail provides but at the same time my module is a "node" module (defines a content type) and maybe this combination is lethal, anyway i think the mimemail_prepare hook is being used in a wrong way.

Comments

sgabe’s picture

Status: Active » Needs review
StatusFileSize
new1.75 KB

The attached patch changes the mimemail_prepare() function to mimemail_prepare_message() to prevent function collision with hook_prepare() in modules that uses MimeMail API and defines custom content type(s).

Please review it and set to RTBC if it's fine.

neoglez’s picture

Thanks for the answer.
It still has a problem (also the patch):

if (is_null($sender)) { // use site default for sender
@@ -168,7 +168,7 @@
$message = $engine_prepare
(also in here must be $engine_prepare_message)
($sender, $recipient, $subject, $body, $plaintext, $headers, $text, $attachments, $mailkey);
}
else {
- $message = mimemail_prepare($sender, $recipient, $subject, $body, $plaintext, $headers, $text, $attachments, $mailkey);
+ $message = mimemail_prepare_message($sender, $recipient, $subject, $body, $plaintext, $headers, $text, $attachments, $mailkey);
}

return $engine('send', $message);

Please post another patch so i can test it and close the issue.
Still a Great module!

sgabe’s picture

StatusFileSize
new2.22 KB

Thanks for your feedback, attaching a revised patch of #1.

If you think it's okay, please don't close the issue, change to RTBC instead.

neoglez’s picture

Status: Needs review » Reviewed & tested by the community

It seems to be OK now. Thanks!

vatavale’s picture

-deleted-

sgabe’s picture

Version: 6.x-1.0-alpha1 » 7.x-1.x-dev
Status: Reviewed & tested by the community » Fixed

Committed to HEAD.

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.