Hi,
I wanted to know if it is possible to have multiple contact forms on my blog that basically send questions to different email accounts, but also have a limit of say 5 emails per week to each account.
After the limit of 5 has been sent for that week I can display a message stating the weekly limit has been reached.
I need to this as I am trying to an experts Q&A section but the experts only agree to 5 emails every week and don't want any more emails than that.
I was thinking about using the Contact Form 7 plugin for Wordpress for the multiple email accounts bit but don't really know how to do the weekly limit.
Any help with how to do so would be much appreciated.
Thanks
Contact Form with weekly limit
Moderator: General Moderators
- John Cartwright
- Site Admin
- Posts: 11470
- Joined: Tue Dec 23, 2003 2:10 am
- Location: Toronto
- Contact:
Re: Contact Form with weekly limit
It would be quite trivial to implement the logic without any third party software.
A simple query to grab an expert that has not been used more than 5 times
[text]SELECT * FROM experts WHERE times_used < 5 LIMIT 1[/text]
Once you have that queried, you want to update his row to indicate it was used
[text]UPDATE experts SET times_used = times_used + 1 WHERE id = $expertid LIMIT 1[/text]
$expertid being the id of the previously selected expert row
And finally, once a week perform via cron job
[text]UPDATE experts SET times_used = 0[/text]
A simple query to grab an expert that has not been used more than 5 times
[text]SELECT * FROM experts WHERE times_used < 5 LIMIT 1[/text]
Once you have that queried, you want to update his row to indicate it was used
[text]UPDATE experts SET times_used = times_used + 1 WHERE id = $expertid LIMIT 1[/text]
$expertid being the id of the previously selected expert row
And finally, once a week perform via cron job
[text]UPDATE experts SET times_used = 0[/text]