Ubercart implements a hook called hook_file_transfer_alter that allows modules to alter the file download at the moment the customer downloads it. E.g. adding a stamp or watermark with the customer's email or the order id #. See http://www.ubercart.org/docs/api/hook_file_transfer_alter for details.

Is this functionality currently possible in Drupal Commerce? I looked through the Commerce File code, but didn't see anything that would have duplicated the function of hook_file_transfer_alter.

Comments

bjornarneson’s picture

*bump*

Anyone else sorted this issue out or developed a slick work-around?

F.G’s picture

+1, i will appreciate this kind of option to prevent multiple online copy

This file containt your private file order, don't publish it online.

kloewer’s picture

Did anyone make any progress with this issue?

recrit’s picture

This functionality can be accomplished by using a file stream that supports altering. I've created http://drupal.org/project/private_dynamic_stream which mimics Drupal's private file system but provides a hook to append any text to the end of the file (@see private_dynamic_stream.api.php for hook details).

The module has just been created and so only git / dev download is available.
If you wanted to update already created files:

  • Set the private dynamic directory to the same as the private file system
  • Update your file_managed database table - replace "private://" with "privatedynamic://"
recrit’s picture

Status: Active » Needs review
recrit’s picture

Status: Needs review » Fixed

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.