the documentation for hook_mail_alter tells us about certain keys for the message array.
one of those keys is the identifier for the message:
mail_id: An id to identify the mail sent. Look into the module source codes for possible mail_id values.
but according to the code this identifier is really 'id'.
xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
// Bundle up the variables into a structured array for altering.
$message = array(
'id' => $module .'_'. $key,
'to' => $to,
'from' => isset($from) ? $from : $default_from,
'language' => $language,
'params' => $params,
'subject' => '',
'body' => array()
);
| Comment | File | Size | Author |
|---|---|---|---|
| #5 | 359853.patch | 4.86 KB | jhodgdon |
| #3 | 359853.patch | 2.13 KB | jhodgdon |
Comments
Comment #1
kleinmp commentedI committed this to the cvs documentation for Drupal 6. I changed references from 'mail_id' to 'id'.
Comment #2
jhodgdonI fixed this up a bit more for D6 (there was still a lingering mail_id in there).
Also I noticed hook_mail doc had the same problem, so I fixed that up too.
It looks like D7 has the same issue. I'll make a patch shortly.
Comment #3
jhodgdonThis patch fixes the array key problem (mail_id should be id) for D7. Also, I fixed up the formmating problem on http://api.drupal.org/api/function/hook_mail_alter/7 (turning the array keys into a bullet list, as they are on http://api.drupal.org/api/function/hook_mail/7), and removed a @return: none declaration in one of the two hooks.
To confirm that it should be id and not mail_id, check the source code for http://api.drupal.org/api/function/drupal_mail/7
Comment #4
dries commentedThere is some inconsistent use of single quotes in the PHPdoc. Some keywords have quotes around them, whereas others don't.
Comment #5
jhodgdonGood point. When I looked more carefully at the doc for those two hooks, rather than just trying to fix the problem identified in this issue, I found a lot of other style, grammar, and clarity issues too. This patch improves both of them considerably, I think.
Note that if this patch is accepted/applied, it should also be ported to D6, so please mark the issue accordingly, thanks!
Comment #7
jhodgdonSetting back to Needs Review in hopes that the patch will get retested. The test bot was apparently malfunctioning (I had about 7 patches fail in that time period, all were doc, none broke the HEAD install I am pretty sure).
Comment #8
dries commentedCommitted to CVS HEAD. Thanks!
Comment #9
jhodgdonNeeds port to D6, or at least a look to see if it's already fixed up there.
Comment #10
jhodgdonFixed in D6. http://drupal.org/cvs?commit=231384