Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
I receive this error when I have uploaded a file to a newsletter node and attempt to send. Newsletters without files send fine.
Notice: Undefined variable: node in SimplenewsSourceNode->getAttachments() (line 780 of /home/content/90/8751990/html/sites/all/modules/simplenews/includes/simplenews.source.inc).
EntityMalformedException: Missing bundle property on entity of type node. in entity_extract_ids() (line 7409 of /home/content/90/8751990/html/includes/common.inc).
Comment | File | Size | Author |
---|---|---|---|
#3 | fix_node_variable.patch | 622 bytes | Berdir |
Comments
Comment #1
BerdirAh well, that happens when you don't really test now code :)
Support for attachments has been re-implemented from scratch for 7.x-1.x and, as you discovered, doesn't work yet.
Will look into it.
Comment #2
ComputerWolf CreditAttribution: ComputerWolf commentedFound the issue.
On line 780 of simplenews.source.inc instead of:
if ($items = field_get_items('node', $node, $field_name)) {
it should be:
if ($items = field_get_items('node', $this->node, $field_name)) {
At least that fixes my issues and sends the files as a link.
Comment #3
BerdirConfirmed, the attached patch fixes the bug.
Note that a bug in mimemail.module that prevented the files from being attached as actual attachments has been fixed just a few hours ago. See #1388786: mimemail_html_body fails to retrieve file's URI
I'm actually not happy how this currently works. E.g. even with the patch, the files are still listed in the body with the direct download URL. This is not desirable, but currently not easy to prevent except by creating your own theme function.
I do have a few ideas, including an "Attachment" formatter for these files. Maybe we'll also postpone this feature and re-implement better later on. Need to discuss this with the other maintainers.
Also no tests yet, these need a bit of work (add a file field, upload a file and so on), so postponing the tests until we've defined what behavior we actually want.
Comment #4
Berdiradding tag
Comment #5
BerdirCommited the fix to prevent the fatal error.
Re-classifying this issue..