vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   vB3 Programming Discussions (https://vborg.vbsupport.ru/forumdisplay.php?f=15)
-   -   need two var's.. simple question.. (https://vborg.vbsupport.ru/showthread.php?t=129273)

andewy3k 10-16-2006 10:48 PM

need two var's.. simple question..
 
I need the two variables, not sure if that's what I can reefer to them as.

Its for my forum statistics panel.

Last Registered User
Top Poster

thanks ahead of time

Kirk Y 10-20-2006 08:36 PM

There's already a variable for the Latest User.

Latest User:
Code:

$newusername = $vbulletin->userstats['newusername'];
Top Poster: [sql]$topposter = $db->query_first("
SELECT userid, usergroupid, IF(displaygroupid=0, usergroupid, displaygroupid) AS displaygroupid, username, posts
FROM " . TABLE_PREFIX . "user
WHERE posts > 0
ORDER BY posts DESC LIMIT 1");[/sql]

Use $topposter[username], $topposter[userid], $topposter[usergroupid], or $topposter[posts] as variables.

andewy3k 10-24-2006 03:38 PM

thanks, so do I paste these right in the template? No right?

Is it possible to just use $newusername and $topposter[username] without that code?

no huh?

some help needed :(

Kirk Y 10-24-2006 07:54 PM

Depending on what page you're trying to display these on, you can use Plugins.

andewy3k 10-24-2006 11:09 PM

FORUMHOME template

maybe in the future FORUMDISPLAY and SHOWTHREAD

let me know how it can be done for FORUMHOME, and if it can for the other two templates.

thanks ahead of time.

Kirk Y 10-24-2006 11:38 PM

Create a New Plugin using Hook Location "forumhome_start". Fill it with this:
Code:

$topposter = $db->query_first("
SELECT userid, usergroupid, IF(displaygroupid=0, usergroupid, displaygroupid) AS displaygroupid, username, posts
FROM " . TABLE_PREFIX . "user
WHERE posts > 0
ORDER BY posts DESC LIMIT 1");

$newusername = $vbulletin->userstats['newusername'];


andewy3k 10-25-2006 08:57 AM

works great! THANK YOU! I used $topposter[username] and $newusername

so if I want to use this plugin on another template I just change the hook location, correct?

Thanks again..

Kirk Y 10-25-2006 06:35 PM

Right, or you can make another hook using the same contents, but change the location. Forumdisplay is (I believe) forumdisplay_start and Showthread is (Again, I believe) showthread_start.


All times are GMT. The time now is 01:12 PM.

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.00993 seconds
  • Memory Usage 1,717KB
  • 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
  • (2)bbcode_code_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)post_thanks_navbar_search
  • (1)printthread
  • (8)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