anonymous user can see attachment link, but not download without authentication
Bacteria Man - January 13, 2009 - 08:30
| Project: | Private Upload |
| Version: | 5.x-1.0-rc2 |
| Component: | Code |
| Category: | feature request |
| Priority: | normal |
| Assigned: | Unassigned |
| Status: | won't fix |
Jump to:
Description
This idea was inspired by my post in the Post Installation forum.
I'd like to allow anonymous users to see private node attachment links, but when clicking on a link they will be redirected to the login page (which would include appropriate context messaging.) The idea is to entice users to become members and gain access to valuable resources.
I'm wondering if this feature is appropriate for Upload Permissions Per Content Type. It seems like a reasonable addition, but perhaps it's beyond the scope and intended purpose of the module.
Thoughts?

#1
On second thought, I'm thinking the Private Upload module is a closer match for my needs.
#2
I'm closing this for the reason above.
#3
I'm switching this feature request from Upload Permissions Per Content Type to Private Upload.
How involved would it be to implement the original post in this thread?
#4
To clarify my idea, the node is accessible by anonymous users but to download the private file requires authentication. The attachment link is exposed, but when the user clicks on the link they are redirected to the login page (or perhaps a page node explaining why they must login or register to access the file.)
#5
Changing to more descriptive title.
#6
I was looking for the same thing
If using CCK - goto file_formatter.inc in filefield folder in module
and paste the following code at the bottom
global $user;
if ($user->uid == 0) {
$url = "";
$link_text = "You must register or login to download attachments.";
}
return '<div class="filefield-file clear-block">'. $icon . l($link_text, $url, $options) .'</div>';
}
I do not know how safe it it. But it worked for me. And it seems to be fine.
#7
There is a Restricted Content module that still displays links to restricted nodes, but has anonymous users be directed to a custom page which tells them to login. If you can move your downloads to a separate node, that should be the right module for you.
#8
Yeah, I like the approach the Restricted content module. However my original requirement was to restrict access to files that are NOT nodes or attachments of nodes.
I'm actually working on a small module that does just that and hope to release it within a couple of weeks (family and work commitments permitting.) The first version will provide "all or nothing" access tied to a single permission, but I can envision doing something more granular in future versions.
#9
Following
#10
Realistically we can't work on Drupal 5 feature requests at this time.
#11
The original idea wasn't limited to Drupal 5, but in any event the end result is Private Download, which is in fact only available for Drupal 6.
Cheers,
John