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
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.