2

WHMCS has a feature for providing downloads to clients. The feature can be found in their admin area at /admin/supportdownloads.php

Is there any action hook for when files are uploaded via the admin area? The only related hook I can find is for when files are downloaded.

What I want do to is add a hook so any file I upload is added to the list of Associated Downloads for each of my products. With all the hook options they have, I'm surprised I can't find one for this...

Jamie
  • 105
  • 1
  • 3
  • 9

1 Answers1

0

While I have not done exactly what you are trying to do, I can tell you that anything you put in the /includes/hooks folder gets executed, regardless of whether it is actually hooked into a specific point. This is incredibly useful for those moments where there aren't any hook points available (or they are documented as being present but not on certain page renders).

So in a php file in the /includes/hooks folder, I start by echoing out the globals variable. WHMCS stores a lot of information in the globals variable that easily permits you to deduce which page you are on. For example, in one of my hooks, I have a function that determines what the file name is that I am on simply by calling up get_filename(); That function checks the request URI and finds the php file being called. If the filename is one I'm looking for (for example 'dologin') I can isolate the code being executed. You continue to isolate based on the page you are looking for (for example, if each request has a certain variable, or requires being logged in you look for those variables).

Once you are sure you have to be on the page in order for the code to fire, then you can write your PHP to grab the form posted data and store it how you like in a secondary table. The only catch is if the form must first be stored into the database, so you need a unique identifier, but that can be gotten around also.

Hope that is of help...

muely2k1
  • 436
  • 2
  • 4