PDA

View Full Version : vBulletin Blog - Show bold title on blog entry search results if the entry contains unread comments


Andreas
11-06-2011, 11:00 PM
This little patch against 4.1.8 Beta 1 does make the blog titles bold on blog entry search results if teh blog entry contains unread comments.

No warranties whatsoever, have fun :)


--- C:/Users/Andreas.ANDREASKNEU/Desktop/blogentry.php Mon Nov 07 21:14:48 2011
+++ C:/xampplite/htdocs/vb418/packages/vbblog/search/result/blogentry.php Mon Nov 07 21:15:12 2011
@@ -69,10 +69,10 @@
}

$set = $vbulletin->db->query_read_slave("
- SELECT blog.*, IF(blog_user.title <> '', blog_user.title, blog.username) AS blogtitle,
- blog_text.pagetext
+ SELECT blog.*, IF(blog_user.title <> '', blog_user.title, blog.username) AS blogtitle, blog_text.pagetext, blog_read.readtime
FROM " . TABLE_PREFIX ."blog AS blog
LEFT JOIN " . TABLE_PREFIX ."blog_text AS blog_text on blog_text.blogtextid = blog.firstblogtextid
+ LEFT JOIN " . TABLE_PREFIX . "blog_read AS blog_read ON (blog_read.blogid = blog.blogid AND blog_read.userid = " . $vbulletin->userinfo['userid'] . ")
$blog_user_join $perm_parts[join]
WHERE blog.blogid IN (" . implode(',', array_map('intval', $ids)) . ") AND ($perm_parts[where])
");
@@ -149,6 +149,11 @@
$blog['time'] = vbdate($vbulletin->options['timeformat'], $blog['dateline']);
$blog['date'] = vbdate($vbulletin->options['dateformat'], $blog['dateline'], true);

+
+ if ($blog['readtime'] < $blog['lastcomment'])
+ {
+ $blog['title'] = '<b>' . $blog['title'] . '</b>';
+ }
$templater = vB_Template::create($template_name);
$templater->register('blog', $blog);
$templater->register('dateline', $blog['dateline']);

Mark.B
11-07-2011, 07:52 PM
Perfect, thanks Andreas. :)