Go Back   vb.org Archive > Community Discussions > Modification Requests/Questions (Unpaid)
FAQ Community Calendar Today's Posts Search

Reply
 
Thread Tools Display Modes
  #1  
Old 04-29-2009, 06:47 PM
RamdonGhai RamdonGhai is offline
 
Join Date: Mar 2009
Posts: 37
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default Need something that locks threads after 35 posts Any Help?

Anyone have any idea? I basically want something that'll lock each thread in a certain board that will lock a thread after it reaches 35 replies
Reply With Quote
  #2  
Old 04-29-2009, 08:11 PM
Lynne's Avatar
Lynne Lynne is offline
 
Join Date: Sep 2004
Location: California/Idaho
Posts: 41,180
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

write a cron job/scheduled task to check all open threads (thread.open = '1') with a post count over 35 (thread.replycount >= 35) and close them (thread.open = '0'). Or, if may be easier to write a plugin that hooks into where the replycount is increased after a thread is made and if you hit 35, also close the thread. Either would work.
Reply With Quote
  #3  
Old 05-13-2009, 08:32 PM
RamdonGhai RamdonGhai is offline
 
Join Date: Mar 2009
Posts: 37
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Thanks alot Lynne,

I've been working on this and can not figure out the syntax

If you (or anyone else) don't midn can you write up an example cron file...

i'm assuming its written in PHP ... but I just want to see an example, once I get the catch of writing those whoooa its going to be awesome.
Reply With Quote
  #4  
Old 05-13-2009, 08:43 PM
Cryo Cryo is offline
 
Join Date: Dec 2003
Location: Buffalo, NY
Posts: 197
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

This should work for the CRON method...

PHP Code:
$cthreads_SQL "UPDATE
                    "
TABLE_PREFIX ."thread
                SET
                    open = 0
                WHERE
                    replycount > 34
                    AND open = 1"
;
                    
$cthreads mysql_query($cthreads_SQL); 
If you're not including the global file you'll need to replace "TABLE_PREFIX" with your table prefix.
Reply With Quote
  #5  
Old 05-13-2009, 08:49 PM
RamdonGhai RamdonGhai is offline
 
Join Date: Mar 2009
Posts: 37
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Originally Posted by Cryo View Post
This should work for the CRON method...

PHP Code:
$cthreads_SQL "UPDATE
                    "
TABLE_PREFIX ."thread
                SET
                    open = 0
                WHERE
                    replycount > 34
                    AND open = 1"
;
                    
$cthreads mysql_query($cthreads_SQL); 
If you're not including the global file you'll need to replace "TABLE_PREFIX" with your table prefix.
This is my first time implementing a cron

so basically i create a new php file with the above code in it... then go to scheduled tasks in adminCP and link to it?
Reply With Quote
  #6  
Old 05-13-2009, 08:58 PM
Cryo Cryo is offline
 
Join Date: Dec 2003
Location: Buffalo, NY
Posts: 197
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Yep, that should work just fine.
Reply With Quote
  #7  
Old 05-13-2009, 09:33 PM
RamdonGhai RamdonGhai is offline
 
Join Date: Mar 2009
Posts: 37
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

awesome ...i think this is going to work... but looking at the code, what statement can I add that will delete all posts after post number 35 (when its locked)
Reply With Quote
  #8  
Old 05-13-2009, 09:48 PM
Cryo Cryo is offline
 
Join Date: Dec 2003
Location: Buffalo, NY
Posts: 197
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

That gets a bit more complicated and involves code that checks each thread. Probably not worth the resources to be honest.
Reply With Quote
  #9  
Old 05-13-2009, 10:08 PM
RamdonGhai RamdonGhai is offline
 
Join Date: Mar 2009
Posts: 37
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Originally Posted by Cryo View Post
That gets a bit more complicated and involves code that checks each thread. Probably not worth the resources to be honest.
if i were to edit the procedure (or function) that is called when making a post to make it impossible to make a reply in a thread already with 35 posts... wouldn't that be more feasible?

A 1-liner would do it, right? (in theory)

That in conjunction with this cron job should do the trick
Reply With Quote
Reply


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 09:47 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
  • Page Generation 0.05986 seconds
  • Memory Usage 2,241KB
  • Queries Executed 11 (?)
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
  • (2)bbcode_php
  • (2)bbcode_quote
  • (1)footer
  • (1)forumjump
  • (1)forumrules
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (1)navbar
  • (3)navbar_link
  • (120)option
  • (9)post_thanks_box
  • (9)post_thanks_button
  • (1)post_thanks_javascript
  • (1)post_thanks_navbar_search
  • (9)post_thanks_postbit_info
  • (9)postbit
  • (9)postbit_onlinestatus
  • (9)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_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