Hi,
There is probably a really easy answer to this, but I'm stumped...
I have a rule which, on saving a piece of content, takes the values of some fields, bounces them into some other fields, and empties the fields they came from. This works fine for text fields, but, when it comes to file fields, it transfers the reference just fine but refuses to delete the old one. I've tried setting the data value for node:my_file to nothing and to 0, I've tried emptying out the record in the database, but nothing works (admittedly, my php skills are pretty limited). I can get rules to hide the content in question, but, for security reasons, that's less than ideal, because it basically leaves behind a publicly accessible download link for anyone who knows the URL.
Would really appreciate some help.
Thanks,
Pav
PS. Great module!
Comments
Comment #1
pav CreditAttribution: pav commentedOk, cracked it eventually. Would be really useful if the function came out of the box though.
Comment #2
pav CreditAttribution: pav commentedPremature celebration... This looks like a bug, but I'm not sure whether it's with Rules or something else. Please see http://drupal.org/node/1450230.
Comment #3
mitchell CreditAttribution: mitchell commentedPlease provide more information so we can document or fix this issue.
Comment #4
mitchell CreditAttribution: mitchell commentedWould you please compile the information you collected to make this issue more actionable?
Comment #5
tobiasbIn my case I want delete the file from a file field (works - no records in file_managed), but it does not delete the data from the tables (field_data_field.../field_revision_field...).
When I use the action to set nothing, then it creates a new entry in file_managed.
Comment #6
rbrownellI was able to do with with the custom php code. Here is a snippit. I got this code from http://dropbucket.org/node/235 and modified it. In this example my rule generates a list of nodes and loops through them. If you don't have a loop you may need to change [list-item:nid] to another token.
Comment #7
TR CreditAttribution: TR commentedI don't see any bug here, and no further information was given.
Deleting a reference to a file does not delete a file, that's the expected behavior. If you want to delete the file, #6 seems like a good solution.