Is there a way to limit the channel form submission to, say, 3 entries, on a PER USER basis?
I would like the user to only submit the form up to 3x…. with ability to either edit/delete one of the entries in the future, and that’s it.
I cannot limit the channel to entries, because I am trying to build a database of information, where each user can submit the form up to 3 times.
Any ideas?
not nativly afaik, you’d need to use the member module or somehow log something unique about the user to be able to limit them (IP for example).
There will be workarounds either way - e.g. users could just make new accounts or use a proxy/VPN for IP changes.
with that, for logging the user, you’d want to also store some way of knowing how many times they have submitted a form
Alternativly, if the user number is relativly small, Each user could have their own Channel and each of those Channels could be limited to 3 Entries.
…and alternatively from that, if you can uniquely ID users; with just a single channel, you could have a field that stores that users Unique ID and then before a form can be submitted (or even displayed); search entries for their UID and if 3 or more Entries are returned, they won’t be able to make a new one. … this would not work in the back end though, it would need to be implemented with Channel Form on the front end - where the users dont have control panel access
If it’s using channel form you could limit the number of times you allow authors access to the new entry form, while still allowing them to edit existing entries.
Something like this:
{!-- limit edit output to 3 entries--}
{exp:channel:entries channel="mychannel" author_id="CURRENT_USER" limit="3" status="open"}
{!-- output edit links for existing entries --}
<a href="http://{entry_id_path=/edit-entry}">Edit {title}</a>
{!-- generate links to create new entry --}
{if count == total_results}
{!-- only link to new entry if limit of 3 hasn't been reached --}
{if count < 3}<a href="http://{path=/new-entry}">New entry</a>{/if}
{/if}
{!-- if no entries exist link to create the first entry --}
{if no_results}
<a href="http://{path=/new_entry}">New entry</a>
{/if}
{/exp:channel:entries}
It’s not perfect because someone could add new entries if they know how URL’s work, but I’ve been running similar code on a site for 7 years and it’s never been an issue.
Packet Tide owns and develops ExpressionEngine. © Packet Tide, All Rights Reserved.