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
  #22  
Old 02-27-2010, 12:05 PM
RedHacker RedHacker is offline
 
Join Date: Jan 2009
Posts: 878
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Originally Posted by cory_booth View Post
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...
Thanks..
Reply With Quote
  #23  
Old 02-27-2010, 12:41 PM
webspider webspider is offline
 
Join Date: Jun 2003
Location: Canada
Posts: 175
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Actually with this code all I get is the date.

What I was asking for was attachment statistics. In the AdminCP > Attachments > Attachment Statistics you get data for several things:

Unique / Total Attachments 83,938
Attachment Filesize Sum 12.61 GB
Disk Space Used 12.34 GB
Storage Type Attachments are currently being stored in the filesystem at /var/www/site/
Average Attachment Filesize 157.6 KB
Total Downloads 3,840,776
Reply With Quote
  #24  
Old 03-05-2010, 06:03 PM
cory_booth cory_booth is offline
 
Join Date: Jul 2006
Posts: 224
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Originally Posted by webspider View Post
Actually with this code all I get is the date.

What I was asking for was attachment statistics. In the AdminCP > Attachments > Attachment Statistics you get data for several things:

Unique / Total Attachments 83,938
Attachment Filesize Sum 12.61 GB
Disk Space Used 12.34 GB
Storage Type Attachments are currently being stored in the filesystem at /var/www/site/
Average Attachment Filesize 157.6 KB
Total Downloads 3,840,776
Hmm...
Sorry this was not the purpose of this widget.
Reply With Quote
  #25  
Old 03-19-2010, 08:46 PM
Ricsca's Avatar
Ricsca Ricsca is offline
 
Join Date: Apr 2006
Posts: 236
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

If the forum in is in the forum folter?
Reply With Quote
  #26  
Old 03-25-2010, 11:34 AM
iyama iyama is offline
 
Join Date: Sep 2008
Posts: 327
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Maybe include Top poster ?
Reply With Quote
  #27  
Old 04-03-2010, 06:59 PM
nul7 nul7 is offline
 
Join Date: Sep 2006
Location: USA
Posts: 71
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

^^^Yeah I was going to say the same thing...kind of like 3.8 had on vbadvance module.

Members: 1,976
Threads: 8,585
Posts: 111,082
Top Poster: XXXXXXXX (6536)

Welcome to our newest member:
XXXXXXXXX
Reply With Quote
  #28  
Old 04-03-2010, 07:08 PM
nul7 nul7 is offline
 
Join Date: Sep 2006
Location: USA
Posts: 71
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

great mod, installed and works great, for the guys/gals getting the time stamp only...make sure you are configuring the php and not putting it in the description box...same thing I did until I realized I was being silly.

just if we could get the top posted code... Me + PHP Coding = fail
Reply With Quote
  #29  
Old 04-20-2010, 06:57 AM
axix20xx axix20xx is offline
 
Join Date: Mar 2009
Location: Iran
Posts: 74
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Originally Posted by Brew View Post
All I get is today's date
Same Here for this and Recent Thread az so ...

Quote:
Originally Posted by cory_booth View Post
Huh... I have no idea about this one...
So how can we fix It ?
Reply With Quote
  #30  
Old 04-20-2010, 12:35 PM
zulfiqar.halari zulfiqar.halari is offline
 
Join Date: Jun 2009
Posts: 19
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

This widget is not working in my Forum as i am not using CMS, rather i want to use it in side bar of my vBulletin forum but its not working and showing as blank.

Let me know whats the correct code to display it in our forum widget side bar.

Regards
Reply With Quote
  #31  
Old 04-23-2010, 06:07 PM
Reef Man Reef Man is offline
 
Join Date: Nov 2006
Posts: 123
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Installed and working.

If you want it translated to spanish, here you have the code:

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>Numero de Miembros: </strong> '.$numbermembers.'<br /> <strong>Temas: </strong>'. $totalthreads.'<br /> <strong>Mensajes: </strong>'. $totalposts.'<br /> <strong>Usuarios en linea: </strong>'. $totalonline.'<br /> <br /> <strong>?ltimo miembro registrado:</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();
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:26 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.05753 seconds
  • Memory Usage 2,384KB
  • 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
  • (1)bbcode_code
  • (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
  • (4)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
  • (1)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