Closed (fixed)
Project:
Subscriptions
Version:
7.x-1.1
Component:
Code
Priority:
Normal
Category:
Bug report
Assigned:
Unassigned
Reporter:
Created:
23 Oct 2012 at 19:46 UTC
Updated:
8 Dec 2012 at 23:20 UTC
I can't include some files with the emails that are sent. I know that the default template are including the code to do it. At first I thought that it was cause my files are private so I tried with a different content type which is public but no dice.
{{!![subs:files:field_myfile:count]#| Attached files:
{{[subs:files:field_myfile:count]#| [subs:files:field_myfile:index:#0:url]
}}}}Nothing is displayed. Do I need to change something else ? Is there a way to include the file as attachements instead of a link in the mail ?
Comments
Comment #1
dmegatool commentedComment #2
salvisI suspect that 'field_myfile' is not the name of your files field.
Comment #3
dmegatool commentedAs if I didn't check that ;-)
For some reason it didn't worked on my dev setup but it's working on the live. Weird cause it's on the same server and all. Guess there's something wrong in my dev configuration :/
Thx for the reply.
Comment #4
dmegatool commentedComment #5
jerry commentedRe-opening this issue because I'm having what seems to be the same problem.
I added a file field (named "field_files", as that's the default in the mail template) to both forum topics and their comments, but the expected file list didn't appear in subsequent Subscriptions E-mail. That part of the template was unchanged, and the fields displayed properly when rendered by the site, but the template tokens weren't working as expected.
A bit of digging around revealed that the files tokens weren't actually added to comment or node templates unless the 'view uploaded files' permission was granted. As that's a D6 core upload.module permission (if I remember correctly), this guaranteed that it would fail with D7 fields. Commenting-out that check (at lines 61 and 103 of file subscriptions_content.tokens.inc) allowed the files tokens to work as expected. I'm not sure if there's a more appropriate check that should be employed instead.
Comment #6
salvisWhoa, this very minute I came to the same conclusion based on feedback from Nigristriata in #1825302: empty tokens when sending out notifications - it depends on who is the recipient.
Thank you for the analysis. We can just remove those checks. Core's file.module takes care of checking access based on whether any containing entity is accessible, which is sufficient here (we don't send inaccessible entities).
The site that I used for testing that feature was actually upgraded from D6 and the users still have the 'view uploaded files' permission, so it worked just fine!
I've just pushed the fix to the -dev version (give it up to 12h to be repackaged).