I created a rule to re-direct anonymous users to the registration form when attempting to view a node that is available only to specified roles. The node has a document attachment in a CCK Filefield field.

The event for my rule is "Content is going to be viewed", the condition is "Viewed content is <name of my content-type> AND Field has value <name of my CCK Filefield field>" and action is "Page redirect <to the register page>

The re-direct rule works when clicking on the node title, but not when clicking on the document link - anonymous users are able to download the document.

How do I configure a rule for the event "File is going to be downloaded"?

Thanks.

Comments

Canine Coaches’s picture

Component: Rules Core » Rules Engine

I have just found the fileframework and related module, which I think will work for you. The power of these modules is unbelievable. You should check them out. I have just found them 2 days ago so I am not sure about setting permissions etc.

Chris

les lim’s picture

There is no event for "File is about to be downloaded". Any time you click on an HTML link pointing to an actual file, that transaction takes place between the browser and the server directly. Drupal doesn't get involved.

You need to prevent the download link from being displayed for the anonymous user in the first place. I'm guessing that this is a problem you're having with a View?

logicexpertise’s picture

@Chris.
I'll have a play with the File framework module and report back if it works for me.

@lesmana
Yes, I'm having the issue with views, and yes I ended up hiding the file link from anonymous users to get the required outcome. However, I'd like anonymous users to see that there's a file, but not be able to download it, so I'm going to see if the File Framework module works for me.

Thanks for your help.

mitchell’s picture

Status: Active » Closed (fixed)

Closing older issues to make the issue queue easier to navigate. If you still need assistance, please try the latest versions, read through the documentation handbooks, and search for other other issues with relevant responses. This will more than likely give you an answer to your question, or you can always open another issue. Thanks.