mailsave 6.x=1.2 changes to integrate with comment_upload module
| Project: | Mailsave |
| Version: | 6.x-1.2 |
| Component: | Code |
| Category: | feature request |
| Priority: | normal |
| Assigned: | Unassigned |
| Status: | needs review |
Jump to:
I have a working (tested) 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 a simple change to mailsave that enables comment_upload to work, 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. The comment_upload module wants each file in $node->files to have an attribute "new" that is set to true if the file is new and should be uploaded (else if the comment were edited in place by the GUI, the files structure would have file objects with the "new" attribute set to FALSE).. Without my change, comment_upload ignores $node->files because the "new" attribute is not set.
In function _mailsave_save_files, change the code fragment from:
if ($file = _mailsave_save_file($attachment, $validators)) {
// Create the $node->files elements
$file->list = variable_get('upload_list_default', 1);
$file->description = $file->filename;
$node->files[$file->fid] = $file;
to:
if ($file = _mailsave_save_file($attachment, $validators)) {
// Create the $node->files elements
$file->list = variable_get('upload_list_default', 1);
$file->description = $file->filename;
// for comment_upload_module use
$file->new = TRUE;
// end of add for comment_upload_module use
$node->files[$file->fid] = $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)
| Attachment | Size |
|---|---|
| mailsave.module.gz | 5.2 KB |

#1
Thanks!
Any reviews to commit?
#2
It gave me this error, when i tried to send a mail with attachment. Text part is processed though
An error occurred. /batch?id=32&op=do
Fatal error: Cannot use object of type stdClass as array in /var/lib/drupal/sites/all/modules/comment_upload/comment_upload.module on line 388
#3
The comment_upload error is also described in this issue: http://drupal.org/node/531690
It seems as though there are two separate issues -- the one addressed by this thread and the one addressed by that thread. This solution seems to work for this issue, but when implementing this with the changes I described in issue #531690, I got links at the bottom of emails but the files hadn't been moved to sites/default/files, so the links didn't work. The files were saved to the root directory of the Drupal installation, but the links pointed at the sites/default/files location.
#4
...addressed the issue of file links not leading to files in: http://drupal.org/node/533602
So the three issues that together seem to have things working alright are this one, that one, and http://drupal.org/node/531690.