create one-off download link?
-
I’d like to customise the download link for digital downloads. I don’t have a file to download, but a some code that generates a link based on settable parameters which would have to be unique each product. This download link would only be accessible after the user has paid.
So first up, I need to be able to store parameters for the product download so that when the user purchases, these parameters can be used to generate the download url.
The current method for getting around this is to make a host page in wordpress, secure it behind a member plugin of some sort, and then set that wordpress page as the download url, and encode the unique parameters to that download page. You end up with a bunch of duplicate download pages, and it’s a horror to manage.
Another option is to set the download url to a custom php page in a wordpress plugin folder which accepts the parameters and calls on internal magic to generate the link. This is insecure because people might be able to guess the url and parameters, and it’s not tied to the MP transaction.
Googling has revealed that it is possible to filter the url, as a possible solution. I’m not entirely sure what this means, but the WPMUDev page this is from toted it as a solution, without really clarifying how to use it, or linking to relevant documentation.
$url = apply_filters(‘mp_download_url’, $url, $order, $download);
This code snippet was without any context of how or where to implement such a filter. It still does now explain how I can have a product with custom download parameters which would be used inside the filter to generate the download url.
- The topic ‘create one-off download link?’ is closed to new replies.