I have spent hours/days trying to figure out how to accomplish this in Drupal 7 using the Rules module, so I will greatly appreciate any help anyone can provide.
What I am trying to do:
When a user re-uploads a file to a node, the node should rollback from an Approved status to Pending Review. This requires some kind of automated rule that checks for when a file was updated.
Here's what I have:
- A node called Data_set with a File field called data_set_file.
- Data_set nodes also have a field called Status (e.g., Pending Review, Approved).
My problem:
When a user uploads and overwrites an existing attachment in the data_set_file field, I want the node's Status to change back from Approved (if already) to Pending Review. I am able to use Rules to check for when a user uploads a new file, but there are no rules conditions to check for which file or node file has been updated.
What I tried:
I created a "NOT Data Comparison" condition between node-unchanged:field-dataset-file:file:fid and (Equals/Negate) node:field-dataset-file:file:fid However, when updating the file, it did not register a change to the fid field (because it keeps the same fid). I also tried the file size field with no effect as well. When I tried the file's timestamp, it appeared to work at first until I realized that the timestamp updates every time, no matter what, that a user saves a node, regardless of whether or not a file was re-uploaded.
I may be going about this the wrong way. Anyone know what's the easiest way to accomplish this? Thanks a million!