1

Is there a way to enforce a limit to the amount of entries a user can create based on their user group

I’ve been digging around a little and can’t seem to find anything that would allow this, I’ve looked at adding my own permissions but I don’t think that’s right as I need/want the value to be a number, not a ‘can the user add x amount’ kinda deal.

Something like:

{% set entries = craft.entries.section(‘listing’).authorId(user.id) %}

{% if entries.count >= userGroup.entryLimit %}
    No more entries for you!
{% else %}
    More entries for you!
{% endif %}

Is the only way to do this by creating a custom plugin?

Thank you!

1

I think a custom plugin is going to be the way to go with this. Your template code would look something like:

{% set entries = craft.entries.section(‘listing’).authorId(user.id) %}

{% if entries.count >= craft.myPlugin.getEntryLimitForUser(user.id) %}
    No more entries for you!
{% else %}
    More entries for you!
{% endif %}

Your plugin would also hook onto the onSaveEntry event and keep an incrementing entry save counter for each user you're tracking.

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.