Needs review
Project:
Private Upload
Version:
6.x-1.x-dev
Component:
Code
Priority:
Normal
Category:
Bug report
Assigned:
Unassigned
Reporter:
Created:
21 Oct 2010 at 17:15 UTC
Updated:
13 Nov 2010 at 11:24 UTC
Jump to comment: Most recent file
Comments
Comment #1
berliner commentedI confirm this error. Might be related to #671574: Document that hook_form_alter not called after a form fails validation
I tested further and tried to move some logic from hook_form_alter to a function called after the build, but it didn't work for me neither. Anyone any idea?
Comment #2
berliner commentedAfter digging through the code of the private_upload module and the core upload module I think the problem is, that upload_js() overwrites the cached form and thus the changes made by private_upload's implementation of hook_form_alter().
I tried to cope with this issue in re-implementing the form cache strategy of the upload module into private_upload. See the attached patch that solves the issue for me. It includes a change to the hook_nodeapi() implementation in order to give all files that are attached to a node a private attribute, reflecting the private state of each file. Also I removed private_upload_form_validate() and private_upload_form_submit() because the former is never used and I couldn't see why it should be. The latter is not necessary anymore with the new changes, because the private checkbox now integrates correctly into the form and its value is accessible in nodeapi's insert/update operation.
I would have liked to keep this patch smaller, but the changes were rather substantial.
Comment #4
berliner commentedThe last patch didn't work when previewing a node. Should be fixed now.