View Single Post
  #1  
Old 05 Apr 2008, 08:44
blackmamba16 blackmamba16 is offline
 
Join Date: Oct 2007
Shwo up new Posts in Navbar?

Heyho,

I'd like to show up new posts in Navbar...

I thought about using the following code from Vbadvanced:

Template navbar

<div><a href="$vboptions[bburl]/search.php?$session[sessionurl]do=getnew">$vbphrase[new_posts]</a>: $newposts</div>
Where do i have to add the PHP code, to let the number of recent Posts show up???

// New posts
if ($mod_options['portal_welcome_newposts'])
{
if (strlen($vbulletin->session->vars['newposts']) > 0 AND !$vbulletin->options['threadmarking'])
{
$newposts = number_format($vbulletin->session->vars['newposts']);
}
else
{
$getnewposts = $db->query_first("
SELECT COUNT(*) AS count
FROM " . TABLE_PREFIX . "post AS post
" . iif($vbulletin->options['threadmarking'],
'LEFT JOIN ' . TABLE_PREFIX . 'threadread AS threadread ON (threadread.threadid = post.threadid AND threadread.userid = ' . $vbulletin->userinfo['userid'] . ')') . "
WHERE dateline >= " . $vbulletin->userinfo['lastvisit'] .
iif($vbulletin->options['threadmarking'],
' AND dateline > IF(threadread.readtime IS NULL, ' . (TIMENOW - ($vbulletin->options['markinglimit'] * 86400)) . ', threadread.readtime)') . "
AND visible = 1
");

if (!$vbulletin->options['threadmarking'])
{
$db->query_write("UPDATE " . TABLE_PREFIX . "session SET newposts = '$getnewposts[count]' WHERE userid = " . $vbulletin->userinfo['userid']);
}

$newposts = vb_number_format($getnewposts['count']);
}
}
--------------- Added 05 Apr 2008 at 09:30 ---------------

ok, got it working by inserting the following Code into Global.php:

// ####### New Posts in Currently Active Users #############
if ($vbulletin->userinfo['userid'] != '0')
{
// Posts
$getnewposts = $db->query_first("SELECT COUNT(*) AS count FROM " . TABLE_PREFIX . "post WHERE visible = 1 AND dateline >= '{$vbulletin->userinfo['lastvisit']}'");
$newposts = number_format($getnewposts['count']);
}
// #################### New Posts in Currently Active Users #######################

BUT it doesnt show count of posts in VbAdvanced Portal ??? Does someone knwo where to add the Code to make the variable $newposts available even in navbar when you are in VBA portal?

Last edited by blackmamba16; 05 Apr 2008 at 09:30. Reason: Auto-Merged DoublePost
Reply With Quote