The Arcive of Official vBulletin Modifications Site.It is not a VB3 engine, just a parsed copy! |
|
#1
|
|||
|
|||
automating thread moves between forums
I need to create some sort of scheduled task or cron job to move all of the threads from one forum to another forum on a daily basis... any suggestions on the best way to approach it? custom sql queries? custom php code that uses vB functions?
vB 3.0.7 Thanks Jason |
#2
|
|||
|
|||
Based on what rules these moves should be done?
|
#3
|
|||
|
|||
I have forum A that is publically viewable. I have forum B that is only viewable by admins. at midnight every night, I need to move ALL threads in forum A to forum B. So, the only rule to identify threads to be moved is that forum=A
|
#4
|
|||
|
|||
A relative easy cronjob should be able to do that. So you will have to write a short php-script that can perform the task.
|
#5
|
||||
|
||||
PHP Code:
|
#6
|
|||
|
|||
Kirby, that was perfect -- Thanks! It worked great in my test site and will hopefully run on my prod site at midnight tonight.
Fortunately, Forum A has "Count Posts Made in this Forum Towards User Post Counts" set to No, so that works out well. This is basically our venting forum.. it allows users to say things they might not otherwise say, knowing that everything will get "purged" daily. Thanks again. |
#7
|
|||
|
|||
I think I'm looking for the same thing; the only difference is adding 1 parameter to see if the thread should be moved.
I'd like to move all threads in one forum with at least 1 reply (2 posts within thread) to be auto-moved to another forum. Do I just need to add an "AND replycount >=1" clause? UPDATE: Working like a charm. If anyone needs the code, the bottom snippet moves all threads with replies from forum id #17 over to forum id #2. I have it running as a cron job once an hour. Code:
<?php error_reporting(E_ALL & ~E_NOTICE); if (!is_object($DB_site)) { exit; } $DB_site->query("UPDATE " . TABLE_PREFIX . "thread SET forumid = 2 WHERE forumid = 17 AND replycount >= 1"); require_once('./includes/functions_databuild.php'); build_forum_counters(2); build_forum_counters(17); log_cron_action('Threads with replies moved from Forum 17 to Forum 2', $nextitem); ?> |
#8
|
|||
|
|||
I love you. I'm clearly going to be using this. w00t!
|
#9
|
|||
|
|||
I used this code and a cron job to auto move threads from my news forum in 3.09. Since I upgraded to 3.5.4, it no longer works. Anyone know why?
|
#10
|
|||
|
|||
Minor change in the function names for accessing the db in 3.5.X:
Code:
<?php error_reporting(E_ALL & ~E_NOTICE); if (!is_object($vbulletin->db)) { exit; } $vbulletin->db->query("UPDATE " . TABLE_PREFIX . "thread SET forumid = 2 WHERE forumid = 17 AND replycount >= 1"); require_once(DIR . '/includes/functions_databuild.php'); build_forum_counters(2); build_forum_counters(17); log_cron_action('Threads with replies moved from 17 to 2', $nextitem); ?> |
Thread Tools | |
Display Modes | |
|
|
X vBulletin 3.8.12 by vBS Debug Information | |
---|---|
|
|
More Information | |
Template Usage:
Phrase Groups Available:
|
Included Files:
Hooks Called:
|