vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   vB3 Programming Discussions (https://vborg.vbsupport.ru/forumdisplay.php?f=15)
-   -   Shwo up new Posts in Navbar? (https://vborg.vbsupport.ru/showthread.php?t=175198)

blackmamba16 04-05-2008 06:44 AM

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

Quote:

<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???

Quote:

// 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 [DATE]1207387846[/DATE] at [TIME]1207387846[/TIME] ---------------

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

Quote:

// ####### 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?

blackmamba16 04-30-2008 05:56 PM

:D push

GameWizard 04-30-2008 10:09 PM

Try adding the code into a new plugin under the hook global_start


All times are GMT. The time now is 08:41 AM.

Powered by vBulletin® Version 3.8.12 by vBS
Copyright ©2000 - 2025, vBulletin Solutions Inc.

X vBulletin 3.8.12 by vBS Debug Information
  • Page Generation 0.02362 seconds
  • Memory Usage 1,716KB
  • Queries Executed 10 (?)
More Information
Template Usage:
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (3)bbcode_quote_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)post_thanks_navbar_search
  • (1)printthread
  • (3)printthreadbit
  • (1)spacer_close
  • (1)spacer_open 

Phrase Groups Available:
  • global
  • postbit
  • showthread
Included Files:
  • ./printthread.php
  • ./global.php
  • ./includes/init.php
  • ./includes/class_core.php
  • ./includes/config.php
  • ./includes/functions.php
  • ./includes/class_hook.php
  • ./includes/modsystem_functions.php
  • ./includes/class_bbcode_alt.php
  • ./includes/class_bbcode.php
  • ./includes/functions_bigthree.php 

Hooks Called:
  • init_startup
  • init_startup_session_setup_start
  • init_startup_session_setup_complete
  • cache_permissions
  • fetch_threadinfo_query
  • fetch_threadinfo
  • fetch_foruminfo
  • style_fetch
  • cache_templates
  • global_start
  • parse_templates
  • global_setup_complete
  • printthread_start
  • bbcode_fetch_tags
  • bbcode_create
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • printthread_post
  • printthread_complete