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
  #12  
Old 02-22-2010, 03:51 PM
cory_booth cory_booth is offline
 
Join Date: Jul 2006
Posts: 224
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Originally Posted by RedHacker View Post
How to display...?

Number of Members ----> Members
Currently Online ----> Online Users
Um...

I thought this was in there already?
or did you mean put the lines in that order (I suppose that would make more sense).
Reply With Quote
  #13  
Old 02-23-2010, 05:02 AM
RedHacker RedHacker is offline
 
Join Date: Jan 2009
Posts: 878
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Translate....
Reply With Quote
  #14  
Old 02-23-2010, 07:00 AM
zulfiqar.halari zulfiqar.halari is offline
 
Join Date: Jun 2009
Posts: 19
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Hi. Can we get this mod for vb4. I will be grateful.

https://vborg.vbsupport.ru/showthrea...ht=live+header

Regards
Reply With Quote
  #15  
Old 02-23-2010, 04:39 PM
x626xblack x626xblack is offline
 
Join Date: Oct 2009
Location: Houston Tx.
Posts: 183
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

You may want to put WIDGET in the thread title. I as other people i assume do searches for new widgets in the title. This one does not come up.
Reply With Quote
  #16  
Old 02-23-2010, 05:30 PM
kevinchappell kevinchappell is offline
 
Join Date: Feb 2010
Posts: 6
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Thank you!
Reply With Quote
  #17  
Old 02-23-2010, 07:55 PM
Brew's Avatar
Brew Brew is offline
 
Join Date: Sep 2002
Posts: 359
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

All I get is today's date
Reply With Quote
  #18  
Old 02-24-2010, 05:30 AM
RedHacker RedHacker is offline
 
Join Date: Jan 2009
Posts: 878
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Originally Posted by RedHacker View Post
How to display...?

Number of Members ----> Members
Currently Online ----> Online Users
cory_booth for this anything....?
Reply With Quote
  #19  
Old 02-26-2010, 10:41 AM
cory_booth cory_booth is offline
 
Join Date: Jul 2006
Posts: 224
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Originally Posted by Brew View Post
All I get is today's date
Huh... I have no idea about this one...
Reply With Quote
  #20  
Old 02-26-2010, 10:44 AM
cory_booth cory_booth is offline
 
Join Date: Jul 2006
Posts: 224
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Originally Posted by RedHacker View Post
cory_booth for this anything....?
I didn't quite understand your request, but I made the change I think you wanted:

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>Members: </strong> '
.$numbermembers.'<br /> <strong>Total Threads: </strong>'$totalthreads.'<br /> <strong>Total Posts: </strong>'$totalposts.'<br /> <strong>Online Users: </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(); 
Just replace the code with this...
Reply With Quote
  #21  
Old 02-27-2010, 10:59 AM
webspider webspider is offline
 
Join Date: Jun 2003
Location: Canada
Posts: 175
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Hi
Great addon.

Is there anyway to add attachment stats? Like Total attachments and Total downloads?

Thanks,
Peter
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 06:42 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.04702 seconds
  • Memory Usage 2,377KB
  • Queries Executed 26 (?)
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_php
  • (4)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
  • (3)pagenav_pagelink
  • (11)post_thanks_box
  • (2)post_thanks_box_bit
  • (11)post_thanks_button
  • (1)post_thanks_javascript
  • (1)post_thanks_navbar_search
  • (1)post_thanks_postbit
  • (11)post_thanks_postbit_info
  • (10)postbit
  • (2)postbit_attachment
  • (11)postbit_onlinestatus
  • (11)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