Hello...

I need help because I'm stuck. I want to add a new cell in 'uc_files_users' table, because I need to record what date users clicks to download a file (creating graphs of this data). Can I simply modify that table in the database? The second thing. How to save this data into database? I know that if the user will download a file multiple times I will need an array, but for now I'm stuck with how to append this extra data with 'onclick' event? What can i modify to achieve this?
One way would be creating hook_module_menu, appending additional onclick event and checking the database with filename and logged in user (user that purchased the file). Maybe a better and quicker method?

Tnx for the help.

Comments

deathL’s picture

Issue summary: View changes
longwave’s picture

Status: Active » Fixed
Issue tags: -file download

I don't think modifying the existing table will work - what if the user downloads the file more than once? Instead you should create your own table separate from Ubercart's own data.

Also, you do not need to do this via an onclick event - file downloads are handled through PHP and you could use hook_uc_file_transfer_alter() or hook_uc_download_authorize() to record when a file is downloaded.

Status: Fixed » Closed (fixed)

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

deathL’s picture

The project was on hold, so sorry for this late new question:

Is it possible to execute custom PHP AFTER the user successfully downloads a file? The hook_uc_file_transfer_alter() or hook_uc_download_authorize() can only execute this before the popup for file download appears. I've searched the net for the right way but there is no way to achieve this. I need to know if the users download was successful.