Hello,
I've read your API tutorial with interest. However, I want to know how to make it so that when the logged in user clicks on an attachment to download it, a number of points are deducted from that user's balance.
A workaround would be to place the download on a separate page to its node, and on that page have x number of points automatically deducted from the user's balance, as in your API tutorial example, but this is untidy and I would prefer my first scenario.
Also, I think the download method would have to be set as private, as with the public (HTTP) method, Drupal has no way of knowing that a file is being downloaded.
I would appreciate any help with this task.
Regards.
Comments
Comment #1
gregglesI think you should make the "external" page simply do the piont deduction and then redirect to the download file. This way you maintain the ease of "click a link, get the file" but still have a way to deduct the points.
Does that solve your problem?
Comment #2
B747 commentedYes, but how do I create this external page and have the original node link to it?
Comment #3
jredding commentedYou could allows just create the page manually and the link to the page by hand as well as the link to the download by hand.
or
programmatically you could create a custom module that was something like
hook_menu to grab
/downloads
this page would call a custom function that would read arg(1). arg(1) would be the file id of the attachment to the node.
i.e. /download/520
This custom function would then grab the file and feed it to the client or does do a redirect to the file's path. It would also,of course, add/subtract points.
only thoughts. Good luck with the coding.
Comment #4
jredding commentedComment #5
berdirSorry for pinging the participants.
Now that Drupal 7 is out, there is no support for Drupal 5 and the
corresponding modules anymore. Therefore, I'm closing all old issues
which are still open.
I suggest you upgrade to Drupal 6 or 7 and figure out if you're feature
is still needed or the bug still exists and open a new issue in that
case.