Hi I am using Akeeba Subscriptions in conjunction with Hikashop to track how many free purchases (they will be downloads) a user can have per their subscription.
I want to write a plugin which:
-When installed adds a field to the hikashop user table named 'download_count' or something along those lines. Default value is 0.
-When a user has purchased a subscription through Akeeba subs (I believe there is even a way to make this purchase through hikashop, which may make it easier?) add a value to the new field which allows them to have x amount of free downloads.
-When a user uses a free purchase (which will be a downloadable audio file) I want to decrement the number in my custom field. Once it reaches 0 the user cannot make any more free purchases until their new subscription.
Is this a feasible idea? I have done some practice plugin development from a book but this is my first real undertaking in developing an actual plugin, and I know there are probably some standards I need to follow within Hikashop.
I was reading the API and was going to call the function onBeforeDownloadFile(&$filename,&$do,&$file) when a user goes to download a file and say decrement by 1.
From my knowledge, to download a file from Hikashop an email gets sent to a user with a link to download a file, so will this function get called when they click that link?
NOTE: The reason I am using Hikashop for this is because the website will also have pages which are 'Subscriber Only' pages and I couldn't think of a better way to integrate that + allowing users to have x amount of free downloads. I can think of ways to do it separately but the only way I could think of joining them together was the creation of a plugin.
Any help would be appreciated as I want to be armed with as much knowledge before I undertake this, as I know it's going to be a tricky task. If anyone has a better idea also I'd love to hear it!