I have a content type called 'uploads' that includes a file field (each of these nodes has just one download 'attached'.)

I have a view that shows just the post date of these nodes, along with a link to the file to be downloaded (relationship: file from field_upload).


2019/01/31 whatever.pdf (linked to /system/files/reports/whatever.pdf) 2019/02/02 whatever2.pdf (linked to /system/files/reports/whatever2.pdf)

As it stands this makes a direct link to the file in question (not the node) - but now I'd like to have some indicator as to whether the file was downloaded (well, at least whether the link to download it was clicked.)

I've set up a boolean field in that content type 'uploads' (used for these files) called 'downloaded', I have rules, VBO, etc installed and am already using it to change other boolean values elsewhere (when a node is updated, etc.)

What I'm trying to do is have this view (showing pairs of post dates/files) have the file link:

  • Trigger a rule first to change the boolean value to indicate it's been downloaded/accessed.
  • Download the file (presumably by actually linking to it.)

I've been failing at this for most of the day and am not sure of the best approach.

I suspect there should be a way to use VBO with 'individual buttons' instead of checkboxes to accomplish my goal, but I don't see a way to trigger a download in rules.

Alternatively I can imagine there's a way to run some php code and accomplish these goals, but it's admittedly over my head without some direction.

Any suggestions much appreciated, and if I'm ranting too much here the long story short is:

"I need a file download link in views that also changes a boolean value when clicked within on."

Any help much appreciated!

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.