Hello, I am wondering if I can seek some support on the following please.
I use s2Member to sell access to downloads of PDF files, it does the job. However, I wish to sell downloads of multiple PDFs in a ZIP folder, which I can do no problem. However, I would like to be able to assign a download count to the ZIP above the standard 1 download. For example, if the ZIP contains 10 PDF files, I wish it to count as 10 downloads not 1.
I have had a couple of developers look at this and this is there response:
We found the area inside WordPress where S2 stores the counter of downloads.What we haven’t been able to find is where those values are assigned. It seems the default way S2 works is to give each file download a count of 1, which is a normal behaviour as you’d expect. What your objective to me was to see if we can assign a different value to different types of file downloads, specifically a Zip file with multiple files inside it. Since there’s no way inside the WP admin area to assign that value to a file, my thought was to try to assign that counter value programmatically.
The place I tried was inside WP’s functions.php file, where I was hoping to be able to override that file value when the page with the file download was built. It’s pretty easy to do that, but I couldn’t find the API elements inside S2 to make that change. When I tried to force it, all of WP would crash and I’d get the “Something bad happened” screen.
After a few of those, I removed my code from functions.php.
Basically, the question for S2 is this: can you change the counter value of a file. If so, is it best to do it programmatically as a function? If we know the answer to that, we can adapt our code to read the file name, where my plan is to place a counter value. For example, we would have a file called Math-year1-group-file5.zip. That file would get downloaded as intended, but our function would fire on download and read the filename for the “file” string and capture the integer right after it (and before the dot.) That would be our value. It also means people making these files wouldn’t have to mess with anything in the WordPress backend, they could just name the file a certain way.
This method of reading the file name requires a step on file creation, but it will end up being much faster than grabbing the file from WordPress OR S3, unpacking it, counting the files, etc. With the volume of downloads you do, that’s a ton of bandwidth and CPU cycles open a zip file and then delete it right away.
Please can anyone advise on this?