![]() |
Auto close thread after x days.
Requested by Skyline_GT
This is a simple script that will close all threads where the last post is 30 days or older Edited script with KirbyDE's code I got it this time :) ... and tested and works Tnx :) only 1 variable to edit here .... default is 30 days but you can change it to whatever you want ;) Please click Install |
Seems to be complicated, and might/will issue a lot of UPDATEs
I think this could also be done in 1 line ;) |
Sorry if i steped on you toes KirbyDE
if updates are required ... its just the code |
Quote:
What do you mean? I just wanted to point out that this can be done with just one UPDATE, instead of querying the table for outdated threads to get the threadis and then issue a query for each thread to close it. Imagine the script is run for the first time and there are 10.000 outdated threads. This would mean 10.001 queries are being executed ... |
I think Kirby was refering to this easier way
|
hmm ... i see where you are comming from ....
can i use your 1 liner? |
Sure :)
I must admit that I didn't test it, but as the query is pretty simple I am 99,75% sure that it does the job. |
Tnx Co-authour ;)
|
I fear that this version will close no threads ...
Let's say TIMENOW is 1106274310 Then $deletedate will be 1103682310 So (TIMENOW - $deletedate) will be 2592000, which is the timestamp of 1970-01-31 01:00:00. I don't think you'll find threads that old anywhere ;) |
oh crap ... i forgot about that the line should be
PHP Code:
|
Fixed and tested
|
How about making it so we can give different boards different XX days. On less active boards we might want to do 60 days for example.
Or even better, delete threads after XX days. And is this XX days after the last reply, or the first post? |
How can make it to close threads in specific forums by id?
I want this active but not in all forums. This can be done in a easy way? Please? Somebody? By the way, this affect all threads? Even the sticky ones? :rolleyes: (If it is, how do to not affect sticky?) |
Try this;
[sql]$DB_site->query(" UPDATE " . TABLE_PREFIX . "thread SET open = 0 WHERE forumid IN (1,2,3) AND open = 1 AND sticky = 0 AND lastpost < " . intval(TIMENOW - (86400 * 30)) ); [/sql] Where (1,2,3) is the list of forum id's you want it to work for, and 30 is the number of days |
Quote:
Thanks Paul :D |
well done guys :)
|
Thank you. This is very useful! :D *clicks install*
Rebecca |
Your welcome :)
|
can this be set for one particular forum or is this for ALL threads because I want to have threads auto close after 8 days in 1 particular forum on my site....is that possible with this hack?
|
bump
|
Looking at the instructions it seems to me that you can not select a forum.
|
Quote:
Code:
ERROR: Unknown Punctuation String @ 9 |
This is a absurd question, but... i'm a newbie on php:
This cronjob close thread after X days since the creation of the thread, or after X days of inactivity? (Are diferent things) How to change that? How to setup this cronjob to close old threads (based on "original post date") or to close inactive threads (based on "last post date")? Thanks for all in advance ;) |
Quote:
Please let me know what I maybe doing wrong? |
Anyone now a fix for my SQL query problem?
|
Thank you Trafix and KirbyDE, worked like a charm. Been looking for this for a very long time : ).
|
Quote:
|
Opps, well it looked like it was a sql query, what you posted.
Got it now..thanks Paul! |
hello
Can these be made that he does it also on Vbulletin 3.6.0 please!! thanks |
I would also like this for 3.6
|
Quote:
|
Hi!
Does this work with vB 3.6.x? Can I apply this to one subforum specific? |
I wrote an auto thread close product for 3.6.2.
You can configure the number of days until close and exclude forums. |
All times are GMT. The time now is 03:33 AM. |
Powered by vBulletin® Version 3.8.12 by vBS
Copyright ©2000 - 2025, vBulletin Solutions Inc.
X vBulletin 3.8.12 by vBS Debug Information | |
---|---|
|
|
![]() |
|
Template Usage:
Phrase Groups Available:
|
Included Files:
Hooks Called:
|