Link Vault
ExpressionEngine 2, ExpressionEngine 3, ExpressionEngine 4, ExpressionEngine 5
Back to this add-on's main page
View Other Add-ons From Masuga Design
Can a member have limit of 10 downloads from a list of 500 items
Support (Resolved)
Djive
|
Posted: 19 August 2016 06:42 AM |
|
|
|
Let me explain:
Member buys 10 modules in exp:resso store and this gives him the right to 10 downloads.
He can download any of available 500 items, but is restricted to only 10 downloads.
After he uses up his 10 downloads limit, he cannot access the repository of those 500 items anymore.
Is this possible to do with Link Vault?
If it is possible, could you share some advice on how to achieve this.
Thank you very much!
|
|
|
Ben Kohl
|
Posted: 19 August 2016 09:38 AM |
# 1
|
|
|
Sure. Assuming you have a way to query the number of remaining downloads the member has, you could use the {exp:link_vault:download_count} tag to compare that number to. If they have maxed out on their available downloads, don’t show the download link.
{if "{exp:link_vault:download_count member_id='{logged_in_member_id}' }" < "{some_download_limit_variable}" } ...Link Vault download link... {/if}
|
|
|
Djive
|
Posted: 19 August 2016 10:12 AM |
# 2
|
|
|
Thanks for your quick response.
1.
For example:
- we have “order quantity” variable from Expresso Store which gives us number of tokens a member has bought.
- I assume a member can download any of the 500 download links available (each link would count as 1 download) and we can compare number of downloads to “order quantity” value?
- but also what when user buys more download tokens, do we just increment the first number (add all the order quantity values together) or is there a better approach?
2.
This is from the documentation:
the :download_count template tag returns the total download count for a specified entry ID or file.
- does this mean we need to have those 500 items for download all in 1 entry (for example a matrix field) for “download_count” tag to work?
Thank you very much for your input so far!
|
|
|
Ben Kohl
|
Posted: 19 August 2016 10:24 AM |
# 3
|
|
|
1. What you described is what I would do. If a member has three separate purchases of ten tokens each, then their download limit would be thirty. How you go about getting that number into the template as a single variable can vary based on how all that data is stored. Maybe a custom query in the template?
2. The :download_count tag is actually more flexible than what that sentence describes. I should change that. You can use a mix and match of any of the parameters that are listed in the docs. The example I provided would just give the total all-time downloads for a particular user. Maybe it would make sense to use more parameters that identify specifically what the person purchased? It’s up to you.
|
|
|