The Arcive of Official vBulletin Modifications Site.It is not a VB3 engine, just a parsed copy! |
|
#1
|
||||
|
||||
Activeusers in Navbar template question
Is there a way to check for activers users in another template, like the navbar, without running a query for it there? Like they do in the forumdisplay.
|
#2
|
||||
|
||||
Anyone have any idea on this?
|
#3
|
||||
|
||||
There is a query for it in the forumdisplay page. Look at line 332.
|
#4
|
||||
|
||||
Actually, I saw that query but didn't see anything about activeusers around it until it did the activeusers template render.
So there is no way to pre-register it from somewhere else for the navbar template then? |
#5
|
|||
|
|||
Shot in the dark, untested, and all that with vBulletin 4.1.0 Patch Level 2...
Say you want active users in the navbar template when you are on the forum.php page. Try adding a plugin to the forumhome_complete hook with this code: Code:
vB_Template::preRegister('navbar', array('activeusers' => $activeusers)); Code:
<div> <ol class="commalist"> {vb:raw activeusers} </ol> </div> Code:
vB_Template::preRegister('navbar', array('activeusers' => $activeusers)); $navbar = render_navbar_template($navbits); Whatever vB kicks out to $activeusers on those various pages should (unless this is all baked) be what you get in the navbar save for tweaks. |
#6
|
||||
|
||||
Quote:
Code:
if ($activeusers) { $template_hook['navbar_community_menu_end'] .= '<li><a href="usermap.php' . $session[sessionurl_q] . '">' . $vbphrase['usermap'] . '</a></li>'; } It doesn't show the link on the forumhome. I really don't want to add a query for this to the parse_template hook as it will add a query to every page, won't it? |
#7
|
|||
|
|||
The parse_templates hook is inside the process_templates function where $activeusers is not in scope. You can try globaling it like below, but if you still get nothing, then it could be that $activeusers isn't set yet, so $activeusers doesn't exist at the parse_templates hook:
Code:
global $activeusers; if ($activeusers) { $template_hook['navbar_community_menu_end'] .= '<li><a href="usermap.php' . $session[sessionurl_q] . '">' . $vbphrase['usermap'] . '</a></li>'; } Code:
if ($vbulletin->userinfo['userid']) { $template_hook['navbar_community_menu_end'] .= '<li><a href="usermap.php' . $session[sessionurl_q] . '">' . $vbphrase['usermap'] . '</a></li>'; } |
#8
|
||||
|
||||
Globalizing activeusers didn't work either, so it must not be set yet, like you said. I can go with the $vbulletin->userinfo['userid'] and leave it at that. Guests won't be able to view it, but that might actually be a good thing in the long run.
Thank you very much for all the help, Carrie. At least we gave it a shot. |
|
|
X vBulletin 3.8.12 by vBS Debug Information | |
---|---|
|
|
More Information | |
Template Usage:
Phrase Groups Available:
|
Included Files:
Hooks Called:
|