Hello,
Thank you in advance for your support.
I use Drupal 7. Currently it is local with mamp on a mac.
Problem/Motivation
I want to use the functionalities of the module.
But I am blocked at the point where when I am editing the webform, and I click on the tab "Protected Downloads", it says "You need to attach private files to this webform".
I played around to be able to attach (I think) a private file. I did it in 2 ways, as you can see in the printscreens:
- by adding a file field in the form, then submitting the form with a file (so the file appeared in /sites/defaule/files/private/webform/)
- by adding a file in the edit tab of the form (so the file appeared in /sites/defaule/files/private/webform/)
Still, it says "You need to attach private files to this webform".
Errors
Working with that form, I also have continuously the following errors:
Notice: Undefined index: en in webform_protected_downloads_node_get_private_files() (line 452 of /Applications/MAMP/htdocs/smartpicker/sites/all/modules/webform_protected_downloads/webform_protected_downloads.module).
Warning: Invalid argument supplied for foreach() in webform_protected_downloads_node_get_private_files() (line 452 of /Applications/MAMP/htdocs/smartpicker/sites/all/modules/webform_protected_downloads/webform_protected_downloads.module).
Thank you very much for your help.
I don't know if it is a bug or if I am making mistakes.
Regards,
Jonathan
| Comment | File | Size | Author |
|---|---|---|---|
| #19 | webform_protected_downloads-7.x-1239916_3.patch | 12.25 KB | berliner |
| #18 | webform_protected_downloads-7.x-1239916_2.patch | 7.88 KB | berliner |
| #14 | webform_protected_downloads-7.x-1239916.patch | 2.21 KB | berliner |
| #5 | screenshot.jpg | 76.88 KB | crismerritt |
| screen_shot_3.png | 110.36 KB | Woodyjon |
Comments
Comment #1
berliner commentedHey, ok,
screen_shot_2.png is wrong.
screen_shot_3.png is closer I think, though I can't tell from the picture.
In general you need to add a private file field to the node type that is used as a webform (so by default the node type "webform"). Have you done this? To check this you can go to admin/structure/types/manage/webform/fields (assuming that webform is your node type), then edit the file field and check that under the "field settings" tab the Upload destination is set to private. If that option is not there go to admin/config/media/file-system and verify that your private filesystem path is correctly set up.
Hope that helps.
For the other errors I will look into that ...
Comment #2
berliner commentedDid you encounter the mentioned notices using the latest dev? If not, could you upgrade please and verify that the problem persists?
Comment #3
Woodyjon commentedHello sir,
Thank you for your reply.
Private files were set up as you mention. My private folder set up in admin/config/media/file-system is: sites/default/files/private.
So I think this seems correct.
I had the version 7.x-1.0-alpha1 which I downloaded yesterday. I just upgraded to the 7.x-1.x-dev version as you requested, and similar problems.
Except that now the error is at line 442 instead of 452.
Notice: Undefined index: en in webform_protected_downloads_node_get_private_files() (line 442 of /Applications/MAMP/htdocs/smartpicker/sites/all/modules/webform_protected_downloads/webform_protected_downloads.module).
Warning: Invalid argument supplied for foreach() in webform_protected_downloads_node_get_private_files() (line 442 of /Applications/MAMP/htdocs/smartpicker/sites/all/modules/webform_protected_downloads/webform_protected_downloads.module).
Comment #4
Woodyjon commentedComment #5
crismerritt commentedSame problem here, also with the latest dev version. Once I have attached the private file, visiting the form gives me:
Notice: Undefined index: en in webform_protected_downloads_node_get_private_files() (line 442 of /Applications/MAMP/htdocs/sites/all/modules/webform_protected_downloads/webform_protected_downloads.module).
Warning: Invalid argument supplied for foreach() in webform_protected_downloads_node_get_private_files() (line 442 of /Applications/MAMP/htdocs/sites/all/modules/webform_protected_downloads/webform_protected_downloads.module).
see also screenshot attached.
I'm happy to provide more info. Let me know.
Comment #6
jim22 commentedI'm having similar problems.
Drupal 7.7
I have created a private file field on webform content type. I have selected Private files as the Upload destination. I created a new webform and added 2 files to the Protected Files field.
I then go to the Protected Downloads tab and it says:
"Protected downloads are not available for the following reasons:
You need to attach private files to this webform."
Updated to latest dev release (Webform Protected Downloads 7.x-1.x-dev), and updated Webform 7.x-3.13 release, with no luck. Still getting the same "You need to attach private files to this webform."
My error message on form page is:
Notice: Undefined index: en in webform_protected_downloads_node_get_private_files() (line 442 of /var/www/vhosts/example.biz/httpdocs/sites/all/modules/webform_protected_downloads/webform_protected_downloads.module).
Warning: Invalid argument supplied for foreach() in webform_protected_downloads_node_get_private_files() (line 442 of /var/www/vhosts/example.biz/httpdocs/sites/all/modules/webform_protected_downloads/webform_protected_downloads.module).
Has anyone had any luck fixing this?
I really appreciate any help.
Comment #7
jschrab commentedI am coming across this same problem in 7.8. Looking at webform_protected_downloads_node_get_private_files() in webform_protected_downloads.module, I have the suspicion that files are being looked for in an inappropriate way. File fields are being looked for by way of key name with a prefix of "field_". I think that Webform changed quite a bit (or is this a D7 with Fields change?) since Webform Protected Downloads was written.
I think webform_protected_downloads_node_get_private_files() should be looking under:
I'd pitch in on this, if I could have confirmation that my thinking is correct.
(Edit - using Webform 7.x-3.13)
Comment #8
berliner commentedFor clarification, the basic functionality of this module is the following:
You have a content type (webform enabled) to which you add a private file field (this is a Fields API field, nothing to do with webform components). Using webform_protected_downloads you can than configure a specific node (webform) in a way that an attached private file (again, nothing to do with webform components) will be made accessible to a user only after he has submitted the webform. So without further regarding the code, your proposition to look for the files under webform components is not the solution to the described problem. Given the mentioned notices regarding undefined language indexes I'm more inclined to think that the problem is related to localization settings. At all those having problems with the D7 version of this module: Are you using the locale module?
Since I'm in holidays right now it's a bit difficult to work on this, but I will try.
Comment #9
opalu commentedYep, exactly the same problems (drupal 7.8 / webform_protected_downloads-7.x-1.x-dev) and I'm using the locale module ...
but yet: happy holidays!
just disabled locale – everything fine (exept of the fact that I need locale).
Comment #10
jschrab commentedI'm not using Locale and have problems with the D7 version of Webform Protected Downloads.
Comment #11
Woodyjon commentedIndeed, by disabling Locale, it works!!
(at least for me)
Comment #12
getstarted commentedI also have the same problem. I am on Dev version of the module with core 7.7 with local module never enabled.
Comment #13
perisdr commentedSame problem here
Though disabling the Local module didn't change anything
Running the dev version.
Comment #14
berliner commentedSince I couldn't reproduce the problem I went directly into the database and provoked the problem by manually switching the nodes language to english (was UND before in my case) but keeping the attached files languages as UND. That way I saw the described message next time I went to the configuration screen. So the reason for the problem is different languages of node and file fields. This can happen in several ways:
1. Having modules that allow language specifications for nodes and fields and uploading files in a language different to the node language
2. Having had modules that ... (this is because deactivating locale modules doesn't automatically reset the nodes or files language)
The current assumption for wpd is, that files must have the same language as the node. In the attached patch I changed that so that simply all attached files of a node can be used, independently of their language settings (if any are given).
Please test this patch against the current dev version. If it solves your problem I would like to get this rolled into an alpha2 release as soon as possible.
And sorry for the monstrous delay, but I have been away for quite some time and only returned for christmas holidays.
Comment #15
Frederic wbase commentedThe path of #14 works perfect with locale enabled, thanks for your hard work berliner!
grts
frederic
Comment #16
perisdr commentedPatch seems to be working fine. Locale is enabled so no problem there.
Thanks berliner
Comment #17
perisdr commentedAfter patching I am getting some warnings when trying to edit my webform
Any ideas?
Comment #18
berliner commentedHi perisdr,
thanks for reporting. I found the problem and some more. I tried to address them all in a new patch. Please note, that the patch in #14 is included in this one, so you need to unpatch it first or to get the current dev version fresh from the repository before applying this patch.
Included in this patch should be the following fixes:
Thanks for testing and feedback!
Comment #19
berliner commentedplease try this patch instead of the previous
Comment #20
perisdr commentedYes the patch seems to take care the warnings when I go editing an existing webform. I will be playing around a little more so if anything more comes up I 'll give you a heads up. So far the log is clear of any webform entries. Hope to remain like this :)
Thanks for the fast fix
Comment #21
feuerste commentedI had the same problems described above (using locale as well). With patch #3 everything works like a charm. I hope you include it soon into the downloadable version.
Thanks for the great work.
Comment #22
berliner commentedThanks for the feedback. The patch has been pushed to the dev branch and an alpha2-release has just been created.