I am also wanting to do this aswell, this is a great mod so far and think it will be even better with the below adjustments. Im just not to sure what I need to replace the below code with.
I have installed the mod as it was downloaded so everything should be as normal.
I made a couple modifications for my use, and figured I'd share in case anyone else wants to do similar. I wanted to display the latest threads based on the last post instead of the first. So, whenever a new post is made in a thread it jumps to the top of the list...and also displays the author as the most recent poster.
Here's my edited code, it replaces the Main Code plugin which runs on forumhome_start.
PHP Code:
// enable to run this script
if ($vbulletin->options['latest_thread_enabled'])
{
$db->hide_errors();
global $vbulletin;
// forum permissions
$forumpermissions = array();
foreach($vbulletin->forumcache AS $forum)
{
$forumpermissions[$forum["forumid"]] = fetch_permissions($forum['forumid']);
if ((!($forumpermissions[$forum["forumid"]] & $vbulletin->bf_ugp_forumpermissions['canview'])) OR (!($forum['options'] & $vbulletin->bf_misc_forumoptions['active']) AND !$vbulletin->options['showprivateforums'] AND !in_array($vbulletin->userinfo['usergroupid'], array(5,6,7))))
{
$forumids .= ','.$forum['forumid'];
}
}
if ($vbulletin->options['latest_thread_exclude']!='')
{
$forumids .= ','.$vbulletin->options['latest_thread_exclude'];
}
$forumids = substr($forumids, 1);
if ($forumids!='')
{
$latest_and = "thread.forumid NOT IN($forumids)";
$latest_and_1 = "forum.forumid NOT IN($forumids)";
}
// converts options to nice variables
$limit = $vbulletin->options['latest_thread_number'];
// query to get the last posts
$query = $vbulletin->db->query_read("
SELECT
thread.forumid as forumid, thread.visible, thread.title as thread_title, thread.threadid as threadid, post.username as username, post.userid as userid, thread.dateline as date,
forum.title as forum_title,
post.postid, post.pagetext as pagetext
FROM " . TABLE_PREFIX . "thread as thread
LEFT JOIN " . TABLE_PREFIX . "post as post on (thread.lastpostid = post.postid)
LEFT JOIN " . TABLE_PREFIX . "forum as forum on (thread.forumid = forum.forumid)
WHERE thread.visible = 1 AND $latest_and AND $latest_and_1 ORDER BY postid DESC
LIMIT $limit"
);
while ($row = $vbulletin->db->fetch_array($query))
{
// allow to use alternate color in rows
require_once(DIR . '/includes/functions.php');
exec_switch_bg();
// strips the bbcode out of the post
$row['pagetext'] = strip_bbcode($row['pagetext'], $stripquotes = true, $fast_and_dirty = false, $showlinks = true);
// adds the cutoff ... with substr
$row['pagetext'] = substr($row['pagetext'], 0, $vbulletin->options['latest_thread_cut']) . '...';
this has been working very well and I am liking it heaps. So thank you again.
I was wondering is there is a way to change the wording of "Author" in the far right row.
I understand it probably wasnt needed originally but I have used the code above so that it displays the last poster of the latest thread. So author is kinda wrong now.
I would like it to say last poster or something like that.
Thanks again for all your hard work.
Chris
im using it here if you need to see what ive done but go easy on me its my first every attempt at anything like this www.paintcorrection.org/forum
I made it a phrase. Search for Author in the phrases.
WOW Thanks for the super quick ammendment. Your a champ.
Although I not sure where to find the phrases, Ill have a search for it. I am but a humble car detailer, far from a IT guru, but I manage to fumble my way through. Ill let you know how I go.