Go Back   vb.org Archive > vBulletin Modifications > vBulletin 4.x Modifications > vBulletin 4.x Add-ons
FAQ Community Calendar Today's Posts Search

Reply
 
Thread Tools
[WIDGET] Forum Stats Details »»
[WIDGET] Forum Stats
Version: 1.00, by cory_booth cory_booth is offline
Developer Last Online: Jun 2013 Show Printable Version Email this Page

Category: vBulletin CMS Widgets - Version: 4.0.2 Rating:
Released: 02-19-2010 Last Update: Never Installs: 205
Re-useable Code Is in Beta Stage  
No support by the author.

This is a simple widget to display some forum stats.

It would really like to see this combined with the Currently Online and Site Visitor's Widgets...

But until then, I am using this PHP Widget...

Feel free to use/hack/slash the code for your own needs...

Navigate to AdminCP -> CMS -> Widgets.
Create a PHP Type Widget and paste the below code.


PHP Code:
ob_start();
global 
$vbulletin$db$vbphrase;
//Begin Forum Stats
// forum stats start
$numbersmembers $db->query_first("SELECT COUNT(*) AS users,MAX(userid) AS max FROM " TABLE_PREFIX "user");
$numbermembers number_format($numbersmembers['users']);
$counter $db->query_first("SELECT COUNT(postid) AS posts, COUNT(threadid) AS threads FROM " TABLE_PREFIX "post");
$totalposts=number_format($counter['posts']);
$countthreads $db->query_first("SELECT COUNT(*) AS threads FROM " TABLE_PREFIX "thread");
$totalthreads=number_format($countthreads['threads']);
// forum stats end

// total online start
$datecut TIMENOW $vbulletin->options['cookietimeout'];
$headerguests=$db->query_first("SELECT COUNT(*) AS count FROM " TABLE_PREFIX "session WHERE userid=0 AND lastactivity>$datecut");
$headerusers=$db->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->query_first("SELECT userid, username FROM " TABLE_PREFIX "user WHERE userid=$numbersmembers[max]");
$newusername $getnewestmember['username'];
$newuserid $getnewestmember['userid'];
// get newest member name and userid end

 //End Forum Status
//SideBar - Begin forum Stats
$sb_stats='
<table width="100%" align="center"> <tr> <td class="" align="left"> <div class="smallfont"> <strong>Number of Members: </strong> '
.$numbermembers.'<br /> <strong>Total Threads: </strong>'$totalthreads.'<br /> <strong>Total Posts: </strong>'$totalposts.'<br /> <strong>Currently Online: </strong>'$totalonline.'<br /> <br /> <strong>Newest Member:</strong> <a href="'.$vboptions[bburl].'/member.php?u='.$newuserid.'"><b>'.$newusername.'</b></a> </td> </tr> </table>';
//SideBar = End forum Status
echo $sb_stats;
$output=ob_get_contents();
ob_end_clean(); 

Screenshots

File Type: jpg stats.jpg (18.0 KB, 0 views)

Show Your Support

  • This modification may not be copied, reproduced or published elsewhere without author's permission.
2 благодарности(ей) от:
kylek, mikesafl

Comments
  #2  
Old 02-20-2010, 03:08 PM
IR15H IR15H is offline
 
Join Date: Feb 2007
Location: England
Posts: 161
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Awesome! I tried to do this a while ago but failed miserably. Thanks .
Reply With Quote
  #3  
Old 02-20-2010, 03:25 PM
cory_booth cory_booth is offline
 
Join Date: Jul 2006
Posts: 224
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Originally Posted by IR15H View Post
Awesome! I tried to do this a while ago but failed miserably. Thanks .
Hey thanks!

I know this isn't pro or anything and not using "caching" but - well until something better comes along :-)
Reply With Quote
  #4  
Old 02-20-2010, 03:37 PM
210665 210665 is offline
 
Join Date: Feb 2009
Posts: 65
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Thanks
is a good Product
Reply With Quote
  #5  
Old 02-20-2010, 04:52 PM
gothi gothi is offline
 
Join Date: Feb 2010
Posts: 7
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Awesome! I love this Widget. I've been waiting all this time.
I have another Widget: "Widget - Users Online" https://vborg.vbsupport.ru/showthrea...et+user+online

My dream is if both would be a widget, but I can not php. which should not be that hard, right?

(sorry my english is terrible)
Reply With Quote
  #6  
Old 02-20-2010, 05:33 PM
DesignWerks DesignWerks is offline
 
Join Date: Apr 2009
Posts: 25
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Nice! Thanks!
Reply With Quote
  #7  
Old 02-20-2010, 05:36 PM
cory_booth cory_booth is offline
 
Join Date: Jul 2006
Posts: 224
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Lynne has got mad skillz and is properly templating and caching her widget.

But I suppose you could merge my code with hers...
I haven't tried it yet, so...

Add this:

PHP Code:
global $vbulletin$db$vbphrase;
//Begin Forum Stats
// forum stats start
$numbersmembers $db->query_first("SELECT COUNT(*) AS users,MAX(userid) AS max FROM " TABLE_PREFIX "user");
$numbermembers number_format($numbersmembers['users']);
$counter $db->query_first("SELECT COUNT(postid) AS posts, COUNT(threadid) AS threads FROM " TABLE_PREFIX "post");
$totalposts=number_format($counter['posts']);
$countthreads $db->query_first("SELECT COUNT(*) AS threads FROM " TABLE_PREFIX "thread");
$totalthreads=number_format($countthreads['threads']);
// forum stats end

// total online start
$datecut TIMENOW $vbulletin->options['cookietimeout'];
$headerguests=$db->query_first("SELECT COUNT(*) AS count FROM " TABLE_PREFIX "session WHERE userid=0 AND lastactivity>$datecut");
$headerusers=$db->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->query_first("SELECT userid, username FROM " TABLE_PREFIX "user WHERE userid=$numbersmembers[max]");
$newusername $getnewestmember['username'];
$newuserid $getnewestmember['userid'];
// get newest member name and userid end

 //End Forum Status

//SideBar - Begin forum Stats
$sb_stats='
<table width="100%" align="center"> <tr> <td class="" align="left"> <div class="smallfont"> <strong>Number of Members: </strong> '
.$numbermembers.'<br /> <strong>Total Thread: </strong>'$totalthreads.'<br /> <strong>Total Posts: </strong>'$totalposts.'<br /> <strong>Currently Online: </strong>'$totalonline.'<br /> <br /> <strong>Newest Member:</strong> <a href="'.$vboptions[bburl].'/member.php?u='.$newuserid.'"><b>'.$newusername.'</b></a></td> </tr> </table>';
//SideBar = End forum Status
echo $sb_stats
Just before her:
PHP Code:
$output=ob_get_contents();
ob_end_clean(); 
At the end...
Reply With Quote
  #8  
Old 02-21-2010, 07:24 AM
gothi gothi is offline
 
Join Date: Feb 2010
Posts: 7
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Thanks for your help, Cory. But I dont find the Code:

Quote:
Originally Posted by cory_booth View Post
Just before her:
PHP Code:
$output=ob_get_contents();
ob_end_clean(); 
At the end...
;_;
Reply With Quote
  #9  
Old 02-21-2010, 06:45 PM
aberg aberg is offline
 
Join Date: Jul 2004
Location: Netherlands
Posts: 124
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Thanks, this is really a good widget.
I have try to merge some code with the widget from Lynne but that doesn't work.
What I like to see is a link to the users online.
Maybe something for the next version.
Reply With Quote
  #10  
Old 02-22-2010, 07:21 AM
RedHacker RedHacker is offline
 
Join Date: Jan 2009
Posts: 878
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

How to display...?

Number of Members ----> Members
Currently Online ----> Online Users
Reply With Quote
Reply


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 02:29 PM.


Powered by vBulletin® Version 3.8.12 by vBS
Copyright ©2000 - 2024, vBulletin Solutions Inc.
X vBulletin 3.8.12 by vBS Debug Information
  • Page Generation 0.04759 seconds
  • Memory Usage 2,363KB
  • Queries Executed 24 (?)
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
  • (4)bbcode_php
  • (2)bbcode_quote
  • (1)footer
  • (1)forumjump
  • (1)forumrules
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (1)modsystem_post
  • (1)navbar
  • (4)navbar_link
  • (120)option
  • (1)pagenav
  • (1)pagenav_curpage
  • (2)pagenav_pagelink
  • (10)post_thanks_box
  • (2)post_thanks_box_bit
  • (10)post_thanks_button
  • (1)post_thanks_javascript
  • (1)post_thanks_navbar_search
  • (1)post_thanks_postbit
  • (10)post_thanks_postbit_info
  • (9)postbit
  • (1)postbit_attachment
  • (10)postbit_onlinestatus
  • (10)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
  • fetch_musername
  • post_thanks_function_fetch_thanks_end
  • post_thanks_function_thanked_already_start
  • post_thanks_function_thanked_already_end
  • post_thanks_function_fetch_thanks_bit_start
  • post_thanks_function_show_thanks_date_start
  • post_thanks_function_show_thanks_date_end
  • post_thanks_function_fetch_thanks_bit_end
  • post_thanks_function_fetch_post_thanks_template_start
  • post_thanks_function_fetch_post_thanks_template_end
  • postbit_imicons
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • postbit_attachment
  • postbit_display_complete
  • post_thanks_function_can_thank_this_post_start
  • pagenav_page
  • pagenav_complete
  • tag_fetchbit_complete
  • forumrules
  • navbits
  • navbits_complete
  • showthread_complete