After the mod was installed we noticed that the forum became horribly slow so I changed the 'gallery_images_forumhome' bit to the following:
PHP Code:
// #################### Latest Gallery-Additions #######################
// fetch the permissions for each forum
// global $vbulletin;
if (isset($forumid) == false)
{
$gal_num_rows = $vbulletin->options['gal_num_rows'];
if ($vbulletin->options['show_latest']==1)
{
// fetch latest pics
$thumbs = $db->query_read("SELECT gallery, threadid, firstpostid, ". TABLE_PREFIX . "thread.title, attachmentid, ". TABLE_PREFIX . "attachment.dateline FROM ". TABLE_PREFIX . "attachment, ". TABLE_PREFIX . "thread, ". TABLE_PREFIX . "forum
WHERE gallery='1' AND ". TABLE_PREFIX . "thread.forumid=". TABLE_PREFIX . "forum.forumid AND ". TABLE_PREFIX . "thread.firstpostid = ". TABLE_PREFIX . "attachment.postid AND ". TABLE_PREFIX . "attachment.dateline < " . TIME() ."
GROUP BY ".TABLE_PREFIX ."thread.threadid
ORDER BY ". TABLE_PREFIX . "attachment.attachmentid DESC LIMIT $gal_num_rows");
while ($gallery = $db->fetch_array($thumbs))
{
eval('$latestgallery .= "' . fetch_template('gallery_latestpictures') . '";');
}
}
// #################### Random Gallery-Additions #######################
// fetch random pics
if ($vbulletin->options['show_random']==1)
{
$random_thumbs = $db->query_read("SELECT gallery, threadid, firstpostid, ". TABLE_PREFIX . "thread.title, attachmentid, ". TABLE_PREFIX . "attachment.dateline FROM ". TABLE_PREFIX . "attachment, ". TABLE_PREFIX . "thread, ". TABLE_PREFIX . "forum
WHERE gallery='1'AND ". TABLE_PREFIX . "thread.featured!='1' AND ". TABLE_PREFIX . "thread.forumid=". TABLE_PREFIX . "forum.forumid AND ". TABLE_PREFIX . "thread.firstpostid = ". TABLE_PREFIX . "attachment.postid AND ". TABLE_PREFIX . "attachment.dateline < " . TIME() ." ORDER BY RAND() LIMIT $gal_num_rows");
while ($rand_gallery = $db->fetch_array($random_thumbs))
{
eval('$random_gallery .= "' . fetch_template('gallery_randompictures') . '";');
}
}
}
the added bits are 'if (isset($forumid) == false)' so the thumbs aren't attempted to load on other pages than forumhome. (got a big speed-increase on the forums after doing this)
also added 'if ($vbulletin->options['show_random']==1)' and 'if ($vbulletin->options['show_latest']==1)' bits to get rid of redundant sqlqueries.
Hope this is of any use to people