Community

Only Authenticated Users Can Download Files

This seems like such a simple question that I feel like I must be missing something obvious.

My situation:

I'm using Drupal 7, and have created a content type which allows files to be attached. I am using private file uploads. When viewing the node, the list of attached files is visible.

What I want to happen:

Authenticated users (those logged in) should be able to click a file link and download the files attached to the node. Anonymous (guest) users should be able to see the list of files, but clicking a file link should present the user with the login page, forcing them to log in to download the attached files.

What currently happens:

Guest users can download the files.

Any ideas? I've searched for this functionality in Drupal Core, and can't see it. I've searched for a module to provide the functionality, and have found none. I've searched for raw PHP code to provide this functionality, and find none. And yet this seems very often requested. Seeing as files exist by default in Drupal, it seems only logical to add a "Can download files" permission by default.

Comments

Hey rvalkass

is private file uploads a module? Drupal 7 supports both public and private downloads simultaneously unlike D6.

Have you tired following this link.

_

Also file_entity should be able to do this as well, and this is the direction file field is going for d8.

_
Don't be a Help Vampire - read and abide the forum guidelines.
If you find my assistance useful, please pay it forward to your fellow drupalers.

this looks promising