vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   Modification Requests/Questions (Unpaid) (https://vborg.vbsupport.ru/forumdisplay.php?f=112)
-   -   Lock Old Threads (https://vborg.vbsupport.ru/showthread.php?t=45548)

Gardener 11-09-2002 07:39 PM

Lock Old Threads
 
Is the any way to automatically lock old threads after a certain. For example, one of the forums on my board imports several news groups. I would like to be able to automatically loke these after the post is 30 days old.

Logician 11-09-2002 08:55 PM

edit newthread.php, find:

PHP Code:

eval("standardredirect(\"".gettemplate("redirect_postthanks")."\",\"$goto\");"); 

before that add:

PHP Code:

$log_lockdate=mktime (date("H"), date("i"), date("s"), date("m"), date("d")-30date("Y"));

$DB_site->query("UPDATE thread SET open=0 WHERE dateline<=$log_lockdate AND forumid=X"); 

Replace X with your forumid you want the auto-lock..

Not tested, first try in a test board! It has SQL query that wil make modifications in the records of your db, so do not apply to your real board without testing it in a test board..

The auto-lock will be triggered whenever someone creates a new thread in your board so do not expect the hack to work if someone does not create a new thread for a few days..

Enjoy

Gardener 11-09-2002 09:18 PM

Thanks for the help. I'll try it out later tonight.

Quote:

The auto-lock will be triggered whenever someone creates a new thread in your board so do not expect the hack to work if someone does not create a new thread for a few days..

Since the news groups are pulled every 15 minutes this shouldn't be a problem.

I'll let you know how it works.

Logician 11-09-2002 09:28 PM

Quote:

Since the news groups are pulled every 15 minutes this shouldn't be a problem.
nope.. The hack is triggerred when someone creates a thread by going the normal way (via newthread.php). So your other hack's threads will not trigger the hack..

But this still shouldnt be a problem since even the slowest forums have at least 1 thread per day..

mzlogical 11-28-2003 10:06 AM

how can you add multiple forums?

Logician 11-28-2003 10:18 AM

change line
PHP Code:

$DB_site->query("UPDATE thread SET open=0 WHERE dateline<=$log_lockdate AND forumid=X"); 

as
PHP Code:

$DB_site->query("UPDATE thread SET open=0 WHERE dateline<=$log_lockdate AND (forumid=X OR forumid=Y OR forumid=Z)"); 


mzlogical 11-28-2003 11:55 AM

Thanks a lot. :D

Joe 05-15-2004 02:49 PM

Quote:

Originally Posted by Logician
edit newthread.php, find:

PHP Code:

eval("standardredirect(\"".gettemplate("redirect_postthanks")."\",\"$goto\");"); 

before that add:

PHP Code:

$log_lockdate=mktime (date("H"), date("i"), date("s"), date("m"), date("d")-30date("Y"));

$DB_site->query("UPDATE thread SET open=0 WHERE dateline<=$log_lockdate AND forumid=X"); 

Replace X with your forumid you want the auto-lock..

Not tested, first try in a test board! It has SQL query that wil make modifications in the records of your db, so do not apply to your real board without testing it in a test board..

The auto-lock will be triggered whenever someone creates a new thread in your board so do not expect the hack to work if someone does not create a new thread for a few days..

Enjoy

Any reason this would NOT work in v3.0.0?


All times are GMT. The time now is 09:57 PM.

Powered by vBulletin® Version 3.8.12 by vBS
Copyright ©2000 - 2025, vBulletin Solutions Inc.

X vBulletin 3.8.12 by vBS Debug Information
  • Page Generation 0.01130 seconds
  • Memory Usage 1,743KB
  • Queries Executed 10 (?)
More Information
Template Usage:
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (6)bbcode_php_printable
  • (3)bbcode_quote_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)post_thanks_navbar_search
  • (1)printthread
  • (8)printthreadbit
  • (1)spacer_close
  • (1)spacer_open 

Phrase Groups Available:
  • global
  • postbit
  • showthread
Included Files:
  • ./printthread.php
  • ./global.php
  • ./includes/init.php
  • ./includes/class_core.php
  • ./includes/config.php
  • ./includes/functions.php
  • ./includes/class_hook.php
  • ./includes/modsystem_functions.php
  • ./includes/class_bbcode_alt.php
  • ./includes/class_bbcode.php
  • ./includes/functions_bigthree.php 

Hooks Called:
  • init_startup
  • init_startup_session_setup_start
  • init_startup_session_setup_complete
  • cache_permissions
  • fetch_threadinfo_query
  • fetch_threadinfo
  • fetch_foruminfo
  • style_fetch
  • cache_templates
  • global_start
  • parse_templates
  • global_setup_complete
  • printthread_start
  • bbcode_fetch_tags
  • bbcode_create
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • printthread_post
  • printthread_complete