Is there a way to restrict the number of custom module items a logged in member can submit.
For example, only one item per member for a specific custom module.
Is there a way to restrict the number of custom module items a logged in member can submit.
For example, only one item per member for a specific custom module.
Hi @Erik
You could look up any existing items that belong to that member from that module, count them, and if over your set limit do not render the create form.
So, using the component type of module_of_member
will return only the logged-in members’ items, omit the layout and pass the data to a Liquid collection, eg:
{% component type: "module_of_member", source: "<Custom Module name/ID>", layout: "", collectionVariable: "memberItems" %}
<!-- get the number of items -->
{% assign itemCount == memberItems.items.size %}
<!-- if member items count is less than your limit allow creation -->
{% if itemCount < 1 %}
<!-- show item create form -->
{% else %}
<!-- show message "limit reached..." -->
{% endif %}
Adam, you are the best! Thank you so much!