Version: 1.0, by Xenon
Developer Last Online: Oct 2023
Version: 3.5.0
Rating:
Released: 10-31-2005
Last Update: 11-21-2005
Installs: 264
DB Changes Uses Plugins Template Edits
Code Changes
No support by the author.
As requested several times, this hack allows you to arrange forums on forumhome in xx columns instead of just one per row as it is in standart vb3. It is a plain port of my 3.0 version you can find here.
Look at the screenshot to know what i mean
The design is changeable in the templates of course
I've tested it, and it should work, but as i don't use it myself, i cannot do a longtime test, so if you find any bugs, report them
Right now, it's just working on forumhome.
I'll add changes for forumdisplay later
Show Your Support
This modification may not be copied, reproduced or published elsewhere without author's permission.
he wants to know the exact steps in centering the forum name & description next to the forum icon.
Ah, ok
The white line is a css issue, you have to check yoir css for something like border-left 1px and set that to 0px! Sorry, I do not use the standardstyle, so I cannot say right now, what style to change in your css!
For the second "problem" try this code in forumhome_forumbit_columncell:
The white line is a css issue, you have to check yoir css for something like border-left 1px and set that to 0px! Sorry, I do not use the standardstyle, so I cannot say right now, what style to change in your css!
For the second "problem" try this code in forumhome_forumbit_columncell:
If you want this to work with Chris M's Cust Forum Status Icons Modification just replace Xenon's function with the following:
PHP Code:
// ###################### Start construct_forum_columns #######################
function construct_forum_columns($parentid, $columncount)
{
global $vbulletin, $stylevar, $vbphrase, $show;
global $imodcache, $lastpostarray, $counters, $inforum;
// this function takes the constant MAXFORUMDEPTH as its guide for how
// deep to recurse down forum lists. if MAXFORUMDEPTH is not defined,
// it will assume a depth of 2.
if ($columncount == 0)
{
// 0 Columns means don't show subforums at all
return '';
}
// call fetch_last_post_array() first to get last post info for forums
if (!is_array($lastpostarray))
{
fetch_last_post_array();
}
if (empty($vbulletin->iforumcache["$parentid"]))
{
return;
}
if (!defined(MAXFORUMDEPTH))
{
define('MAXFORUMDEPTH', 1);
}
$forumbits = '';
$counter = 0;
foreach ($vbulletin->iforumcache["$parentid"] AS $forumid)
{
// grab the appropriate forum from the $vbulletin->forumcache
$forum = $vbulletin->forumcache["$forumid"];
$lastpostforum = $vbulletin->forumcache["$lastpostarray[$forumid]"];
if (!$forum['displayorder'] OR !($forum['options'] & $vbulletin->bf_misc_forumoptions['active']))
{
continue;
}
$forumperms = $vbulletin->userinfo['forumpermissions']["$forumid"];
$lastpostforumperms = $vbulletin->userinfo['forumpermissions']["$lastpostarray[$forumid]"];
if (!($forumperms & $vbulletin->bf_ugp_forumpermissions['canview']) AND !$vbulletin->options['showprivateforums'])
{ // no permission to view current forum
continue;
}
// do stuff if we are not doing subscriptions only, or if we ARE doing subscriptions,
// and the forum has a subscribedforumid
if (!$subsonly OR ($subsonly AND !empty($forum['subscribeforumid'])))
{
$GLOBALS['forumshown'] = true; // say that we have shown at least one forum
if (($forum['options'] & $vbulletin->bf_misc_forumoptions['cancontainthreads']))
{ // get appropriate suffix for template name
$tempext = '_post';
}
else
{
$tempext = '_nopost';
}
if (!$vbulletin->options['showforumdescription'])
{ // blank forum description if set to not show
$forum['description'] = '';
}
// dates & thread title
$lastpostinfo = $vbulletin->forumcache["$lastpostarray[$forumid]"];
// 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']);
// do light bulb
$forum['statusicon'] = fetch_forum_lightbulb($forumid, $lastpostinfo, $forum);
$show['customstatusicon'] = false;
if ($forum['hasstatusicons'])
{
$show['customstatusicon'] = true;
if ($forum['statusicon'] == 'new')
{
$forum['customicon'] = $forum['statusiconon'];
}
if ($forum['statusicon'] == 'new_lock')
{
$forum['customicon'] = $forum['statusiconlockon'];
}
if ($forum['statusicon'] == 'old')
{
$forum['customicon'] = $forum['statusiconoff'];
}
if ($forum['statusicon'] == 'old_lock')
{
$forum['customicon'] = $forum['statusiconlockoff'];
}
if ($forum['statusicon'] == 'link')
{
$forum['customicon'] = $forum['statusiconlink'];
}
}
// add lock to lightbulb if necessary
if ((!($forumperms & $vbulletin->bf_ugp_forumpermissions['canpostnew']) OR !($forum['options'] & $vbulletin->bf_misc_forumoptions['allowposting'])) AND $vbulletin->options['showlocks'] AND !$forum['link'])
{
$forum['statusicon'] .= '_lock';
}
// get counters from the counters cache ( prepared by fetch_last_post_array() )
$forum['threadcount'] = $counters["$forum[forumid]"]['threadcount'];
$forum['replycount'] = $counters["$forum[forumid]"]['replycount'];
// get moderators ( this is why we needed cache_moderators() )
if ($vbulletin->options['showmoderatorcolumn'])
{
$showmods = array();
$listexploded = explode(',', $forum['parentlist']);
foreach ($listexploded AS $parentforumid)
{
if (!isset($imodcache["$parentforumid"]))
{
continue;
}
foreach($imodcache["$parentforumid"] AS $moderator)
{
if (isset($showmods["$moderator[userid]"]))
{
continue;
}
// build the template for the current forum
$column_width = intval(100 / $columncount) . '%';
eval('$column = "' . fetch_template("forumhome_forumbit_columncell") . '";');
// do the columnstuff
if ($counter % $columncount == 0)
{
// Begin a new row
$forumbits .= "\t<tr>\n";
}
$forumbits .= $column;
if ($counter % $columncount == $columncount - 1)
{
// End row
$forumbits .= "\t</tr>\n";
}
$counter++;
}
}
Fatal error: Cannot redeclare construct_forum_columns() (previously declared in /home/username/public_html/forum/includes/functions_forumlist.php:312) in /home/username/public_html/forum/includes/functions_forumlist.php on line 312
my functions_forumlist.php looks like this (As it does not state in the instructions properly where to insert it so i inserted it right after the first instruction that is in the txt file)
PHP Code:
if ($vbulletin->userinfo['field7'] == 'yes' AND THIS_SCRIPT == 'index' AND $forum['subforumcolumns'] != 1 AND ($subsonly OR $depth < MAXFORUMDEPTH))
{
$childforumbits = construct_forum_columns($forum['forumid'], $forum['subforumcolumns']);
}
else if ($subsonly)
{
$childforumbits = construct_forum_bit($forum['forumid'], 1, $subsonly);
}
else if ($depth < MAXFORUMDEPTH)
{
$childforumbits = construct_forum_bit($forum['forumid'], $depth, $subsonly);
}
else
{
$childforumbits = '';
}
// ###################### Start construct_forum_columns #######################
function construct_forum_columns($parentid, $columncount)
{
global $vbulletin, $stylevar, $vbphrase, $show;
global $imodcache, $lastpostarray, $counters, $inforum;
// this function takes the constant MAXFORUMDEPTH as its guide for how
// deep to recurse down forum lists. if MAXFORUMDEPTH is not defined,
// it will assume a depth of 2.
if ($columncount == 0)
{
// 0 Columns means don't show subforums at all
return '';
}
// call fetch_last_post_array() first to get last post info for forums
if (!is_array($lastpostarray))
{
fetch_last_post_array();
}
if (empty($vbulletin->iforumcache["$parentid"]))
{
return;
}
if (!defined(MAXFORUMDEPTH))
{
define('MAXFORUMDEPTH', 1);
}
$forumbits = '';
$counter = 0;
foreach ($vbulletin->iforumcache["$parentid"] AS $forumid)
{
// grab the appropriate forum from the $vbulletin->forumcache
$forum = $vbulletin->forumcache["$forumid"];
$lastpostforum = $vbulletin->forumcache["$lastpostarray[$forumid]"];
if (!$forum['displayorder'] OR !($forum['options'] & $vbulletin->bf_misc_forumoptions['active']))
{
continue;
}
$forumperms = $vbulletin->userinfo['forumpermissions']["$forumid"];
$lastpostforumperms = $vbulletin->userinfo['forumpermissions']["$lastpostarray[$forumid]"];
if (!($forumperms & $vbulletin->bf_ugp_forumpermissions['canview']) AND !$vbulletin->options['showprivateforums'])
{ // no permission to view current forum
continue;
}
// do stuff if we are not doing subscriptions only, or if we ARE doing subscriptions,
// and the forum has a subscribedforumid
if (!$subsonly OR ($subsonly AND !empty($forum['subscribeforumid'])))
{
$GLOBALS['forumshown'] = true; // say that we have shown at least one forum
if (($forum['options'] & $vbulletin->bf_misc_forumoptions['cancontainthreads']))
{ // get appropriate suffix for template name
$tempext = '_post';
}
else
{
$tempext = '_nopost';
}
if (!$vbulletin->options['showforumdescription'])
{ // blank forum description if set to not show
$forum['description'] = '';
}
// dates & thread title
$lastpostinfo = $vbulletin->forumcache["$lastpostarray[$forumid]"];
// 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']);
// do light bulb
$forum['statusicon'] = fetch_forum_lightbulb($forumid, $lastpostinfo, $forum);
$show['customstatusicon'] = false;
if ($forum['hasstatusicons'])
{
$show['customstatusicon'] = true;
if ($forum['statusicon'] == 'new')
{
$forum['customicon'] = $forum['statusiconon'];
}
if ($forum['statusicon'] == 'new_lock')
{
$forum['customicon'] = $forum['statusiconlockon'];
}
if ($forum['statusicon'] == 'old')
{
$forum['customicon'] = $forum['statusiconoff'];
}
if ($forum['statusicon'] == 'old_lock')
{
$forum['customicon'] = $forum['statusiconlockoff'];
}
if ($forum['statusicon'] == 'link')
{
$forum['customicon'] = $forum['statusiconlink'];
}
}
// add lock to lightbulb if necessary
if ((!($forumperms & $vbulletin->bf_ugp_forumpermissions['canpostnew']) OR !($forum['options'] & $vbulletin->bf_misc_forumoptions['allowposting'])) AND $vbulletin->options['showlocks'] AND !$forum['link'])
{
$forum['statusicon'] .= '_lock';
}
// get counters from the counters cache ( prepared by fetch_last_post_array() )
$forum['threadcount'] = $counters["$forum[forumid]"]['threadcount'];
$forum['replycount'] = $counters["$forum[forumid]"]['replycount'];
// get moderators ( this is why we needed cache_moderators() )
if ($vbulletin->options['showmoderatorcolumn'])
{
$showmods = array();
$listexploded = explode(',', $forum['parentlist']);
foreach ($listexploded AS $parentforumid)
{
if (!isset($imodcache["$parentforumid"]))
{
continue;
}
foreach($imodcache["$parentforumid"] AS $moderator)
{
if (isset($showmods["$moderator[userid]"]))
{
continue;
}
// build the template for the current forum
$column_width = intval(100 / $columncount) . '%';
eval('$column = "' . fetch_template("forumhome_forumbit_columncell") . '";');
// do the columnstuff
if ($counter % $columncount == 0)
{
// Begin a new row
$forumbits .= "\t<tr>\n";
}
$forumbits .= $column;
if ($counter % $columncount == $columncount - 1)
{
// End row
$forumbits .= "\t</tr>\n";
}
$counter++;
}
}
Yes, combining this hack with Chris's will allow this functionality with an even better way in managing it. Instead of hardcoding it in the template it's all done inside the forum manager.
Fatal error: Cannot redeclare construct_forum_columns() (previously declared in /home/username/public_html/forum/includes/functions_forumlist.php:312) in /home/username/public_html/forum/includes/functions_forumlist.php on line 312
my functions_forumlist.php looks like this (As it does not state in the instructions properly where to insert it so i inserted it right after the first instruction that is in the txt file)
PHP Code:
if ($vbulletin->userinfo['field7'] == 'yes' AND THIS_SCRIPT == 'index' AND $forum['subforumcolumns'] != 1 AND ($subsonly OR $depth < MAXFORUMDEPTH))
{
$childforumbits = construct_forum_columns($forum['forumid'], $forum['subforumcolumns']);
}
else if ($subsonly)
{
$childforumbits = construct_forum_bit($forum['forumid'], 1, $subsonly);
}
else if ($depth < MAXFORUMDEPTH)
{
$childforumbits = construct_forum_bit($forum['forumid'], $depth, $subsonly);
}
else
{
$childforumbits = '';
}
// ###################### Start construct_forum_columns #######################
function construct_forum_columns($parentid, $columncount)
{
global $vbulletin, $stylevar, $vbphrase, $show;
global $imodcache, $lastpostarray, $counters, $inforum;
// this function takes the constant MAXFORUMDEPTH as its guide for how
// deep to recurse down forum lists. if MAXFORUMDEPTH is not defined,
// it will assume a depth of 2.
if ($columncount == 0)
{
// 0 Columns means don't show subforums at all
return '';
}
// call fetch_last_post_array() first to get last post info for forums
if (!is_array($lastpostarray))
{
fetch_last_post_array();
}
if (empty($vbulletin->iforumcache["$parentid"]))
{
return;
}
if (!defined(MAXFORUMDEPTH))
{
define('MAXFORUMDEPTH', 1);
}
$forumbits = '';
$counter = 0;
foreach ($vbulletin->iforumcache["$parentid"] AS $forumid)
{
// grab the appropriate forum from the $vbulletin->forumcache
$forum = $vbulletin->forumcache["$forumid"];
$lastpostforum = $vbulletin->forumcache["$lastpostarray[$forumid]"];
if (!$forum['displayorder'] OR !($forum['options'] & $vbulletin->bf_misc_forumoptions['active']))
{
continue;
}
$forumperms = $vbulletin->userinfo['forumpermissions']["$forumid"];
$lastpostforumperms = $vbulletin->userinfo['forumpermissions']["$lastpostarray[$forumid]"];
if (!($forumperms & $vbulletin->bf_ugp_forumpermissions['canview']) AND !$vbulletin->options['showprivateforums'])
{ // no permission to view current forum
continue;
}
// do stuff if we are not doing subscriptions only, or if we ARE doing subscriptions,
// and the forum has a subscribedforumid
if (!$subsonly OR ($subsonly AND !empty($forum['subscribeforumid'])))
{
$GLOBALS['forumshown'] = true; // say that we have shown at least one forum
if (($forum['options'] & $vbulletin->bf_misc_forumoptions['cancontainthreads']))
{ // get appropriate suffix for template name
$tempext = '_post';
}
else
{
$tempext = '_nopost';
}
if (!$vbulletin->options['showforumdescription'])
{ // blank forum description if set to not show
$forum['description'] = '';
}
// dates & thread title
$lastpostinfo = $vbulletin->forumcache["$lastpostarray[$forumid]"];
// 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']);
// do light bulb
$forum['statusicon'] = fetch_forum_lightbulb($forumid, $lastpostinfo, $forum);
$show['customstatusicon'] = false;
if ($forum['hasstatusicons'])
{
$show['customstatusicon'] = true;
if ($forum['statusicon'] == 'new')
{
$forum['customicon'] = $forum['statusiconon'];
}
if ($forum['statusicon'] == 'new_lock')
{
$forum['customicon'] = $forum['statusiconlockon'];
}
if ($forum['statusicon'] == 'old')
{
$forum['customicon'] = $forum['statusiconoff'];
}
if ($forum['statusicon'] == 'old_lock')
{
$forum['customicon'] = $forum['statusiconlockoff'];
}
if ($forum['statusicon'] == 'link')
{
$forum['customicon'] = $forum['statusiconlink'];
}
}
// add lock to lightbulb if necessary
if ((!($forumperms & $vbulletin->bf_ugp_forumpermissions['canpostnew']) OR !($forum['options'] & $vbulletin->bf_misc_forumoptions['allowposting'])) AND $vbulletin->options['showlocks'] AND !$forum['link'])
{
$forum['statusicon'] .= '_lock';
}
// get counters from the counters cache ( prepared by fetch_last_post_array() )
$forum['threadcount'] = $counters["$forum[forumid]"]['threadcount'];
$forum['replycount'] = $counters["$forum[forumid]"]['replycount'];
// get moderators ( this is why we needed cache_moderators() )
if ($vbulletin->options['showmoderatorcolumn'])
{
$showmods = array();
$listexploded = explode(',', $forum['parentlist']);
foreach ($listexploded AS $parentforumid)
{
if (!isset($imodcache["$parentforumid"]))
{
continue;
}
foreach($imodcache["$parentforumid"] AS $moderator)
{
if (isset($showmods["$moderator[userid]"]))
{
continue;
}
// build the template for the current forum
$column_width = intval(100 / $columncount) . '%';
eval('$column = "' . fetch_template("forumhome_forumbit_columncell") . '";');
// do the columnstuff
if ($counter % $columncount == 0)
{
// Begin a new row
$forumbits .= "\t<tr>\n";
}
$forumbits .= $column;
if ($counter % $columncount == $columncount - 1)
{
// End row
$forumbits .= "\t</tr>\n";
}
$counter++;
}
}
I'm ALWAYS encountering the above error just because of line 312 (function construct_forum_columns($parentid, $columncount))
How do I go about this and did i insert the new function in properly??
Using a completely new function_forumlist.php file apply the edit and then add the function I mentioned above at the bottom of the file. Make sure you do it before the