PDA

View Full Version : lastpostinfo for sub-forums


jamesk
03-23-2007, 04:03 AM
in FORUMHOME (index.php generally the only user of this template) the primary categories are followed by a list of either categories and/or forums (as forumbit level 2 template generated entities; either post or nopost depending on whether they are a category or forum). this display lists the LAST POST for each of these entries.

if you also choose to have your forums display a "third plus" level of sub-forums you get output something like this:

Sub-Forums: forum1, forum2, forum3, forum4

with no additional data.

if i modify the template forumhome_subforumbit_nopost to display the $forum[lastpostinfo] information along with the $forum[forumid] and $forum[title] information normally generated into the output, the result is "empty" data.

how or where can i cause the $forum[lastpostinfo] to be loaded (read from the database) when the other subforum info is?

so far i have figured out that i need to insert the equivalent of this code fragment into construct_subforum_bit in functions_forumlist.php



// compare last post time for this forum with the last post time specified by
// the $lastpostarray, and if it's less, use the last post info from the forum
// specified by $lastpostarray
if ($vbulletin->forumcache["$lastpostarray[$forumid]"]['lastpost'] > 0)
{
if (!($lastpostforumperms & $vbulletin->bf_ugp_forumpermissions['canview']) OR (!($lastpostforumperms & $vbulletin->bf_ugp_forumpermissions['canviewothers']) AND $lastpostinfo['lastposter'] != $vbulletin->userinfo['username']))
{
$forum['lastpostinfo'] = $vbphrase['private'];
}
else
{
$lastpostinfo['lastpostdate'] = vbdate($vbulletin->options['dateformat'], $lastpostinfo['lastpost'], 1);
$lastpostinfo['lastposttime'] = vbdate($vbulletin->options['timeformat'], $lastpostinfo['lastpost']);
$lastpostinfo['trimthread'] = fetch_trimmed_title($lastpostinfo['lastthread']);

if ($vbulletin->forumcache["$lastpostforum[forumid]"]['options'] & $vbulletin->bf_misc_forumoptions['allowicons'] AND $icon = fetch_iconinfo($lastpostinfo['lasticonid']))
{
$show['icon'] = true;
}
else
{
$show['icon'] = false;
}

$show['lastpostinfo'] = (!$lastpostforum['password'] OR verify_forum_password($lastpostforum['forumid'], $lastpostforum['password'], false));

eval('$forum[\'lastpostinfo\'] = "' . fetch_template('forumhome_lastpostby') . '";');
}
}
else if (!($forumperms & $vbulletin->bf_ugp_forumpermissions['canview']))
{
$forum['lastpostinfo'] = $vbphrase['private'];
}
else
{
$forum['lastpostinfo'] = $vbphrase['never'];
}

however, the output is always PRIVATE or NEVER so... something else needs to be fixed yet.

figured it out. had to add:



$lastpostforumperms = $vbulletin->userinfo['forumpermissions']["$lastpostarray[$forumid]"];