Limit number of times an action can be performed in a day?

I would like my app to have different price tiers, with each tier having a maximum number of times per day that a person can do a particular action, such as start a chat with a new person.

How do I limit the number of times an action can be performed per time period (in my case per day?)


Hi @FarFutureFox
How far have you got in trying?

What is your db structure?
What actions in particular, other than chat?
Do you mean, send max 3 msgs to another user.
Send max 3 msgs in 1 day?

Hi Rozza,

I haven’t started yet actually, nor decided on which other actions to control. I actually mean to limit the number of times a user can start a chat with a new user: 3 new chats per day. He could still access old chat conversations.

I would have a table of UserActions with a relationship.
Every time a message is sent then you create a record in UserActions.
UserSend, UserRcv, Date, Newchat?

Then on the ‘Send Message’ button you need a condition, to evaluate the number of records in that table, pertaining to the logged in user

OR you could maybe do it all on the Users table, with a count field that is reset from the Send screen Action and a record of last reset date.

It is certainly possible.

There is an irony in building functionality to limit user actions. :grin:

This topic was automatically closed 10 days after the last reply. New replies are no longer allowed.