I'm trying to hook one of the queries below into postbit_display_start in a new plugin.
Code:
// #################### Latest Gallery-Additions #######################
// fetch the permissions for each forum
// global $vbulletin;
$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
$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 returns a blank page on thread view without an error message. Basically I want to add some additional information to the user postbit information, such as a link to the user's profile if he\she has uploaded gallery images. Why does this return a blank page upon thread view? Any help would be appreciated.
So far I have changed the names of the variables, which doesn't matter. Removed num-row etc. All that is needed is to check if a user has uploaded a gallery image.