vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   Modification Requests/Questions (Unpaid) (https://vborg.vbsupport.ru/forumdisplay.php?f=112)
-   -   Need something that locks threads after 35 posts Any Help? (https://vborg.vbsupport.ru/showthread.php?t=212455)

RamdonGhai 04-29-2009 05:47 PM

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

Lynne 04-29-2009 07:11 PM

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.

RamdonGhai 05-13-2009 07:32 PM

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.

Cryo 05-13-2009 07:43 PM

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.

RamdonGhai 05-13-2009 07:49 PM

Quote:

Originally Posted by Cryo (Post 1810309)
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?

Cryo 05-13-2009 07:58 PM

Yep, that should work just fine.

RamdonGhai 05-13-2009 08:33 PM

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)

Cryo 05-13-2009 08:48 PM

That gets a bit more complicated and involves code that checks each thread. Probably not worth the resources to be honest.

RamdonGhai 05-13-2009 09:08 PM

Quote:

Originally Posted by Cryo (Post 1810349)
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


All times are GMT. The time now is 03:12 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.03661 seconds
  • Memory Usage 1,734KB
  • 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
  • (2)bbcode_php_printable
  • (2)bbcode_quote_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)post_thanks_navbar_search
  • (1)printthread
  • (9)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