Go Back   vb.org Archive > Community Discussions > Modification Requests/Questions (Unpaid)
  #1  
Old 11-09-2002, 07:39 PM
Gardener's Avatar
Gardener Gardener is offline
 
Join Date: Apr 2002
Posts: 47
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default 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.
Reply With Quote
  #2  
Old 11-09-2002, 08:55 PM
Logician's Avatar
Logician Logician is offline
 
Join Date: Nov 2001
Location: inside vb code
Posts: 4,449
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

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
Reply With Quote
  #3  
Old 11-09-2002, 09:18 PM
Gardener's Avatar
Gardener Gardener is offline
 
Join Date: Apr 2002
Posts: 47
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

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.
Reply With Quote
  #4  
Old 11-09-2002, 09:28 PM
Logician's Avatar
Logician Logician is offline
 
Join Date: Nov 2001
Location: inside vb code
Posts: 4,449
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

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..
Reply With Quote
  #5  
Old 11-28-2003, 10:06 AM
mzlogical
Guest
 
Posts: n/a
Default

how can you add multiple forums?
Reply With Quote
  #6  
Old 11-28-2003, 10:18 AM
Logician's Avatar
Logician Logician is offline
 
Join Date: Nov 2001
Location: inside vb code
Posts: 4,449
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

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)"); 
Reply With Quote
  #7  
Old 11-28-2003, 11:55 AM
mzlogical
Guest
 
Posts: n/a
Default

Thanks a lot.
Reply With Quote
  #8  
Old 05-15-2004, 02:49 PM
Joe Joe is offline
 
Join Date: Oct 2001
Posts: 75
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

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?
Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT. The time now is 04:03 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.04469 seconds
  • Memory Usage 2,239KB
  • Queries Executed 13 (?)
More Information
Template Usage:
  • (1)SHOWTHREAD
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (1)ad_showthread_beforeqr
  • (1)ad_showthread_firstpost
  • (1)ad_showthread_firstpost_sig
  • (1)ad_showthread_firstpost_start
  • (6)bbcode_php
  • (3)bbcode_quote
  • (1)footer
  • (1)forumjump
  • (1)forumrules
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (1)navbar
  • (3)navbar_link
  • (120)option
  • (8)post_thanks_box
  • (8)post_thanks_button
  • (1)post_thanks_javascript
  • (1)post_thanks_navbar_search
  • (8)post_thanks_postbit_info
  • (8)postbit
  • (6)postbit_onlinestatus
  • (8)postbit_wrapper
  • (1)spacer_close
  • (1)spacer_open
  • (1)tagbit_wrapper 

Phrase Groups Available:
  • global
  • inlinemod
  • postbit
  • posting
  • reputationlevel
  • showthread
Included Files:
  • ./showthread.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/functions_bigthree.php
  • ./includes/class_postbit.php
  • ./includes/class_bbcode.php
  • ./includes/functions_reputation.php
  • ./includes/functions_post_thanks.php 

Hooks Called:
  • init_startup
  • init_startup_session_setup_start
  • init_startup_session_setup_complete
  • cache_permissions
  • fetch_postinfo_query
  • fetch_postinfo
  • fetch_threadinfo_query
  • fetch_threadinfo
  • fetch_foruminfo
  • style_fetch
  • cache_templates
  • global_start
  • parse_templates
  • global_setup_complete
  • showthread_start
  • showthread_getinfo
  • forumjump
  • showthread_post_start
  • showthread_query_postids
  • showthread_query
  • bbcode_fetch_tags
  • bbcode_create
  • showthread_postbit_create
  • postbit_factory
  • postbit_display_start
  • post_thanks_function_post_thanks_off_start
  • post_thanks_function_post_thanks_off_end
  • post_thanks_function_fetch_thanks_start
  • post_thanks_function_fetch_thanks_end
  • post_thanks_function_thanked_already_start
  • post_thanks_function_thanked_already_end
  • fetch_musername
  • postbit_imicons
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • postbit_display_complete
  • post_thanks_function_can_thank_this_post_start
  • tag_fetchbit_complete
  • forumrules
  • navbits
  • navbits_complete
  • showthread_complete