We use cookies to improve your experience. No personal information is gathered and we don't serve ads. Cookies Policy.

ExpressionEngine Logo ExpressionEngine
Features Pricing Support Find A Developer
Partners Upgrades
Blog Add-Ons Learn
Docs Forums University
Log In or Sign Up
Log In Sign Up
ExpressionEngine Logo
Features Pro new Support Find A Developer
Partners Upgrades
Blog Add-Ons Learn
Docs Forums University Blog
  • Home
  • Forums

Limit channel form submission to xx entries

How Do I?

andrew001's avatar
andrew001
136 posts
5 years ago
andrew001's avatar andrew001

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?

       
templateee's avatar
templateee
10 posts
5 years ago
templateee's avatar templateee

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

       
Rob Allen's avatar
Rob Allen
2,950 posts
5 years ago
Rob Allen's avatar Rob Allen

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.

       

Reply

Sign In To Reply

ExpressionEngine Home Features Pro Contact Version Support
Learn Docs University Forums
Resources Support Add-Ons Partners Blog
Privacy Terms Trademark Use License

Packet Tide owns and develops ExpressionEngine. © Packet Tide, All Rights Reserved.