
09-10-2016, 06:55 PM
|
|
|
Join Date: Mar 2012
Posts: 63
Благодарил(а): 0 раз(а)
Поблагодарили:
0 раз(а) в 0 сообщениях
|
|
Quote:
Originally Posted by MarkFL
Create a new plugin hooked at "cron_script_cleanup_hourly" with the following code:
PHP Code:
global $vbulletin, $db;
$fids = '1,2,3';
$title1 = 'title_1';
$title2 = 'title_2';
$v_threads = $vbulletin->db->query_read("
SELECT thread.*
FROM " . TABLE_PREFIX . "thread AS thread
WHERE views > 99
AND forumid IN (" . $fids . ")
");
while ($v_thread = $vbulletin->db->fetch_array($v_threads))
{
$newprefix = '';
if (($vthread['views'] < 500) AND ($vthread['prefixid'] != $title1))
{
$newprefix = $title1;
}
elseif ($vthread['views'] > 499) AND ($vthread['prefixid'] != $title2))
{
$newprefix = $title2;
}
if ($newprefix)
{
$dataman =& datamanager_init('Thread_FirstPost', $vbulletin, ERRTYPE_ARRAY, 'threadpost');
$dataman->set_existing($v_thread);
$dataman->set('prefixid', $newprefix);
$dataman->save();
unset($dataman);
build_forum_counters($v_thread['forumid']);
build_thread_counters($v_thread['threadid']);
}
}
Now, in the line:
PHP Code:
$fids = '1,2,3';
Input the comma-delimited list of forumids in which you wish this to happen.
In the lines:
PHP Code:
$title1 = 'title_1';
$title2 = 'title_2';
replace 'title_1' and 'title_2' with the ids of the prefixes you have defined for this purpose.
Note: I haven't tested this, but it is based on a plugin from one of my products I use at MHB. Please let me know if you have any issues with it. 
|
Appreciate it. I'll try it out and let you know
|