simple change to integrate with mailsave module
| Project: | Comment Upload |
| Version: | 6.x-1.x-dev |
| Component: | Code |
| Category: | feature request |
| Priority: | normal |
| Assigned: | Unassigned |
| Status: | postponed |
Jump to:
I am working off the Aug 11 HEAD but checking the Aug 18 HEAD, I see my change would still apply.
I have a working site integrating mailhandler, listhandler, mailsave, comment_upload and comment_subscribe so that emails to a email list are posted into a forum as new topics or comments, and via integration with mailsave and a simple change to comment_upload, emails to the list that are in reply to other mails/forum topics will be posted to the forum as comments, and attachments in these emails are properly loaded via comment_upload. Here is the simple change:
The mailsave module sets up $node->files so that it is an array of objects. The comment_upload module wants $node->files to be an array of file arrays. Without my change, comment_upload fails when trying to process the $node->files because the object type does not agree with its array reference.
In the function comment_upload_save(), change the code fragment from:
foreach ($comment['files'] as $fid => $file) {
if (!empty($file['remove'])) {
comment_upload_delete_file($file);
}
to:
foreach ($comment['files'] as $fid => $file) {
// mailsave wants files to be array of objects
// but this module wants a file to be an array,
// so convert them to array
if (!is_array($file)) {
$file = (array)$file;
}
if (!empty($file['remove'])) {
comment_upload_delete_file($file);
}
My configuration is as follows:
Drupal 6.3 core
Mailhandler 6.x-1.3
Listhandler HEAD from July 30 (still seems to be latest)
Mailsave 6.x-1.2
Comment_Subscribe 6.x-1.1
Comment_Upload 6.x-1.x-dev (2008-Aug-11)

#1
I'd need a patch against the current version to reopen.