@Kofoid: Try this code for the plugin: gallery_images_forumhome
Code:
// #################### Latest Gallery-Additions #######################
// fetch the permissions for each forum
// global $vbulletin;
if ($vbulletin->options['show_latest']) {
$gal_num_rows = $vbulletin->options['gal_num_rows'];
$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 the permissions for each forum
if ($vbulletin->options['show_random']) {
$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') . '";');
}
}
$top5 = $db->query_read("SELECT gallery,". TABLE_PREFIX . "thread.featured, threadid, firstpostid, ". TABLE_PREFIX . "thread.title, attachmentid, ". TABLE_PREFIX . "attachment.dateline, ". TABLE_PREFIX . "thread.views 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 ". TABLE_PREFIX . "thread.views DESC LIMIT $gal_num_rows");
while ($top_gallery = $db->fetch_array($top5))
{
eval('$top5_gallery .= "' . fetch_template('gallery_top5') . '";');
}
// featured forum
$feat_rows=$gal_feat_rows;
$featured_thumbs = $db->query_read("SELECT ". TABLE_PREFIX . "thread.featured, threadid, firstpostid, ". TABLE_PREFIX . "thread.title, MAX(". TABLE_PREFIX . "attachment.attachmentid)AS attachmentid, ". TABLE_PREFIX . "attachment.dateline FROM ". TABLE_PREFIX . "attachment, ". TABLE_PREFIX . "thread, ". TABLE_PREFIX . "forum
WHERE ". 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() ."
GROUP BY ".TABLE_PREFIX ."thread.threadid
ORDER BY ". TABLE_PREFIX . "attachment.attachmentid DESC LIMIT $feat_rows");
while ($featured = $db->fetch_array($featured_thumbs))
{
eval('$featured_gallery .= "' . fetch_template('gallery_featured') . '";');
}
This will remove two queries, if those gallery-options are not used. Tell me, if it works, and i'll build up the whole plugin this way. This is just a workaround, no final solution for this problem. But it may help a bit.
Hi there - I tried this and it adds 4 queries to my forumhome - does that sound right?
My Admins and my Super Mods can see the gallery but my Mods and registered members and custom groups cannot see them. They get red X's. I setup the permission for them to see but still nothing.