The Arcive of Official vBulletin Modifications Site.It is not a VB3 engine, just a parsed copy! |
|
Live Forum Statistics in Header Template Details »» | |||||||||||||||||||||||||||
Live Forum Statistics in Header Template
Developer Last Online: Feb 2016
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
|
Comments |
#2
|
|||
|
|||
looks really good...I guess I need to disable the info at the bottom of forumhome to save some queries??
|
#3
|
|||
|
|||
Looks good Nice one.
|
#4
|
|||
|
|||
thanks
|
#5
|
|||
|
|||
nice work duno if i will use it yet
|
#6
|
|||
|
|||
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? |
#7
|
||||
|
||||
** Template hack updated for forums using table_prefixes **
Enjoy !! |
Thread Tools | |
|
|
X vBulletin 3.8.12 by vBS Debug Information | |
---|---|
|
|
More Information | |
Template Usage:
Phrase Groups Available:
|
Included Files:
Hooks Called:
|