Go Back   vb.org Archive > vBulletin Modifications > Archive > vB.org Archives > vBulletin 3.0 > vBulletin 3.0 Full Releases
Live Forum Statistics in Header Template Details »»
Live Forum Statistics in Header Template
Version: 1.01, by Neutral Singh Neutral Singh is offline
Developer Last Online: Feb 2016 Show Printable Version Email this Page

Version: 3.0.9 Rating:
Released: 09-01-2005 Last Update: 10-30-2005 Installs: 1
Template Edits
 
No support by the author.

Live Forum Statistics in Header Template
Should work in all vB 3.0.x series


I have absolutely no clue, who had originally written this bit of code as i only found this in a post somewhere, a long long times back (can't recollect). I would be more than glad to know the original writer of this useful code to give proper credit.

Requested by :
Myself [img]images/newsm/devious.gif[/img]

Context :
Searched through vb.org but could not find a similar plugin/hack for vB3.5/vB3.0.x. I wanted to show all vital forum stats like total posts, total threads, total members and newest member on each page of my forum as well as vBa CMPS, in header template and this plugin performs exactly the same function.

What this hack does ?
Stores the desired information from your forum database into php variables and when called in 'header 'template, produces the desired results.

Utility :
Imagine... an unregistered/guest visits your website for the first time via a search engine link (95% of times its not the homepage that is found via a search engines link) and the first thing s/he notices is the forum header information and says wow!! this forum has got xxxx members, xxxxx threads, xxxxxx posts, why not get registered with this community and see what this forum has got in store for me. LOL!! quite true actually. [img]images/newsm/wink.gif[/img]

Demo : http://www.sikhphilosophy.net

Any Screenshots : Demo is self-explanatory above.

Warning: This hack executes 5 queries per page.

Installation Instructions : (Also attached.)

Code:
Step by Step Instructions: 

1. In the 'header' template:

Find: (ususally at the end of the template file)

<!-- content table -->
$spacer_open


Add Above:
<!-- Forum Stats in Header Template -->
<table width="100%" border="0" cellspacing="0" cellpadding="0">
  <tr>
	<td>
	  <div align="left">| Discussions: $totalthreads | Messages: $totalposts | Members: $numbermembers | Online: $totalonline  | Newest :
Code:
$newusername(Welcome!)
</span>
	 </td>
  </tr>
</table>
<!-- Forum Stats in Header Template -->


Ofcourse you can customise this code to suit your website setup. ;)


2. In phpinclude_start template add the following code at the end.

// forum stats start 
        $numbersmembers=$DB_site->query_first("SELECT COUNT(*) AS users,MAX(userid) AS max FROM " . TABLE_PREFIX . "user"); 
        $numbermembers=number_format($numbersmembers['users']); 
        $countposts=$DB_site->query_first("SELECT COUNT(postid) AS posts, COUNT(threadid) AS threads FROM " . TABLE_PREFIX . "post"); 
        $totalposts=number_format($countposts['posts']); 
        $countthreads=$DB_site->query_first("SELECT COUNT(*) AS threads FROM " . TABLE_PREFIX . "thread"); 
        $totalthreads=number_format($countthreads['threads']); 
// forum stats end 

// total online start 
        $datecut = TIMENOW - $vboptions['cookietimeout']; 
        $headerguests=$DB_site->query_first("SELECT COUNT(*) AS count FROM " . TABLE_PREFIX . "session WHERE userid=0 AND lastactivity>$datecut"); 
        $headerusers=$DB_site->query_first("SELECT COUNT(DISTINCT(userid)) AS count FROM " . TABLE_PREFIX . "session WHERE " . TABLE_PREFIX . "session.userid>0 AND " . TABLE_PREFIX . "session.lastactivity>$datecut"); 
        $headerguests=$headerguests[count]; 
        $headerusers=$headerusers[count]; 
        $totalonline=$headerguests+$headerusers; 
// total online end

// get newest member name and userid start 
        $getnewestmember=$DB_site->query_first("SELECT userid, username FROM " . TABLE_PREFIX . "user WHERE " . TABLE_PREFIX . "userid=$numbersmembers[max]"); 
        $newusername = $getnewestmember['username']; 
        $newuserid = $getnewestmember['userid']; 
// get newest member name and userid end



And you are done!!

Please dont forget to click Install

Enjoy !!

Show Your Support

  • This modification may not be copied, reproduced or published elsewhere without author's permission.

Comments
  #2  
Old 09-02-2005, 05:09 PM
Nordinho Nordinho is offline
 
Join Date: Aug 2004
Location: Netherlands
Posts: 288
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

looks really good...I guess I need to disable the info at the bottom of forumhome to save some queries??
Reply With Quote
  #3  
Old 09-03-2005, 07:02 PM
Koopa Koopa is offline
 
Join Date: Nov 2001
Posts: 60
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Looks good Nice one.
Reply With Quote
  #4  
Old 09-04-2005, 01:41 AM
vakvak vakvak is offline
 
Join Date: Mar 2005
Location: T?rkiye
Posts: 87
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

thanks
Reply With Quote
  #5  
Old 09-04-2005, 01:00 PM
Thug Thug is offline
 
Join Date: Feb 2004
Location: Sheffield : uk
Posts: 783
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

nice work duno if i will use it yet
Reply With Quote
  #6  
Old 09-28-2005, 02:31 AM
HHU HHU is offline
 
Join Date: Sep 2005
Posts: 99
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Installed.. thanks

Actually, how would I create it so that you can click on the newest member and it will go to their userid profile page?
Reply With Quote
  #7  
Old 10-31-2005, 03:15 AM
Neutral Singh's Avatar
Neutral Singh Neutral Singh is offline
 
Join Date: Sep 2004
Location: Sikh Philosophy Network
Posts: 545
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

** Template hack updated for forums using table_prefixes **

Enjoy !!
Reply With Quote
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT. The time now is 11:16 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.13471 seconds
  • Memory Usage 2,253KB
  • Queries Executed 20 (?)
More Information
Template Usage:
  • (1)SHOWTHREAD
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (1)ad_showthread_beforeqr
  • (2)bbcode_code
  • (1)footer
  • (1)forumjump
  • (1)forumrules
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (1)modsystem_post
  • (1)navbar
  • (6)navbar_link
  • (120)option
  • (7)post_thanks_box
  • (7)post_thanks_button
  • (1)post_thanks_javascript
  • (1)post_thanks_navbar_search
  • (7)post_thanks_postbit_info
  • (6)postbit
  • (7)postbit_onlinestatus
  • (7)postbit_wrapper
  • (1)spacer_close
  • (1)spacer_open
  • (1)tagbit_wrapper 

Phrase Groups Available:
  • global
  • inlinemod
  • postbit
  • posting
  • reputationlevel
  • showthread
Included Files:
  • ./showthread.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/functions_bigthree.php
  • ./includes/class_postbit.php
  • ./includes/class_bbcode.php
  • ./includes/functions_reputation.php
  • ./includes/functions_post_thanks.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
  • showthread_start
  • showthread_getinfo
  • forumjump
  • showthread_post_start
  • showthread_query_postids
  • showthread_query
  • bbcode_fetch_tags
  • bbcode_create
  • showthread_postbit_create
  • postbit_factory
  • postbit_display_start
  • post_thanks_function_post_thanks_off_start
  • post_thanks_function_post_thanks_off_end
  • post_thanks_function_fetch_thanks_start
  • post_thanks_function_fetch_thanks_end
  • post_thanks_function_thanked_already_start
  • post_thanks_function_thanked_already_end
  • fetch_musername
  • postbit_imicons
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • postbit_display_complete
  • post_thanks_function_can_thank_this_post_start
  • tag_fetchbit_complete
  • forumrules
  • navbits
  • navbits_complete
  • showthread_complete