Jump to content

Forum post limitations


doddsey_65

Recommended Posts

Hi, i am wanting to implement a post restriction on the forum im building where a new user can only post 10 posts per day and create 2 topics per day.

I have thought about the process but have become stuck. I am fine for checking if they have reached their post count for the day(just a simple +1 to the table when they post then query it before posting)

but how would i reset the counter after the day is up?

i have also done the bit that defines how long ago they registered.

 

So if a user registered less than 1 week ago they are only permitted 10 posts and 2 topics per day. After the day ends they can post 10 more posts and 2 more topics(numbers are examples only). Then when they pass 1 week registered they can do anything.

 

I just dont know how to reset the counter at the end of the day. This is my example code so far:

 

$timeslot = (strtotime("-1 week"));
$reg_date = (strtotime($posts_info->user_regdate));

if ($reg_date <= $timeslot)
	{ THEY CAN DO ANYTHING
} else {

if $todays_post_count == 10)
{ THEY CANT POST }
else {
THEY CAN POST
}


Link to comment
https://forums.phpfreaks.com/topic/215106-forum-post-limitations/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.