vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   Modification Graveyard (https://vborg.vbsupport.ru/forumdisplay.php?f=224)
-   -   vBulletin Forum Sideblocks - [OzzModz] Attachment Stats Sideblock (https://vborg.vbsupport.ru/showthread.php?t=297284)

ozzy47 04-16-2013 10:00 PM

[OzzModz] Attachment Stats Sideblock
 
Another mod brought to you by,
https://vborg.vbsupport.ru/external/2015/01/1.png

This mod will add a attachment statistics block to your forum sideblocks.

-------------------------------------------------------------------------------------------

If you like this mod please hit the https://vborg.vbsupport.ru/external/2015/08/1.png button to the right ---->

Please remember to click the, https://vborg.vbsupport.ru/external/2015/08/2.png button to the right if you installed the mod ---->

What does 'Marking As Installed' do ?

* It helps you to stay on top of updates - members who have installed modifications will be notified whenever new updates are available.

* For security issues - vbulletin.org will contact all members who have installed a modification whenever a security issue is brought to their attention.

* Marking a modification as installed also helps me know how many people are using my work, giving me extra incentive to provide more features and new modifications.

I appreciate the support!
-------------------------------------------------------------------------------------------

Go to ACP / Forums & Moderators / Forum Blocks Manager and click on Add New Block, and in the next screen choose Custom HTML/PHP then click Continue.

Set it up the following way.

Title: Attachment Stats (or what ever you want)

Description: Leave blank or fill it in if you wish.

Cache Time (in minutes): I set mine to 10 but you can set it to what ever you want.

Display Order:Any order you want to get the proper order.

Content Type: Choose the PHP one.

In the field Content add this code:

PHP Code:

$astats $this->registry->db->query_first("
        SELECT COUNT(*) AS count, SUM(filesize) AS totalsize, SUM(counter) AS downloads
        FROM " 
TABLE_PREFIX "attachment AS a
        INNER JOIN " 
TABLE_PREFIX "filedata AS fd ON (a.filedataid = fd.filedataid);
    "
);

    
$fstats $this->registry->db->query_first("
        SELECT COUNT(*) AS count, SUM(filesize) AS totalsize
        FROM " 
TABLE_PREFIX "filedata AS fd
    "
);
    
    if (
$astats['count'])
    {
        
$astats['average'] = vb_number_format(($astats['totalsize'] / $astats['count']), 1true);
    }
    else
    {
        
$astats['average'] = '0.00';
    }

$stats=
<table width="100%" align="center"> 
    <tr> 
        <td class="" align="left"> 
            <div class="smallfont"> <b>Unique / Total Attachments: </b> '
.vb_number_format($astats['count']) . ' / ' vb_number_format($fstats['count']).'<br /><br /> 
                <b>Attachment File-size Sum: </b>'
vb_number_format(iif(!$astats['totalsize'], 0$astats['totalsize']), 1true).'<br /><br /> 
                <b>Disk Space Used: </b>'
vb_number_format(iif(!$fstats['totalsize'], 0$fstats['totalsize']), 1true).'<br /><br /> 
                <b>Average File-size: </b>'
$astats['average'].'<br /><br /> 
                <b>Total Downloads: </b>'
vb_number_format($astats['downloads']).'
            </div> 
        </td> 
    </tr> 
</table>'

//SideBar = End forum Status 
//echo $stats; 

return $stats

Template to Use: leave it set to block_html

mikesafl 04-16-2013 11:59 PM

Hey i remember this lol thank you so much

ozzy47 04-17-2013 12:07 AM

No problem, glad ya like it.

kapii 04-17-2013 12:17 AM

Nice, this will help fill some space on my sideblocks, I like all the info included, same as in the ACP, thanks for sharing.

ozzy47 04-17-2013 12:23 AM

Yeah I figured include it all in there, glad it suits your needs.

heyzeus909 09-09-2013 06:33 AM

Very cool - thank you!

ozzy47 09-09-2013 09:13 AM

Glad ya like it, and thanks for marking as installed. :)

Reef Man 03-24-2014 09:24 PM

Can this be used in a VBadvanced module? how?

Cusski 04-21-2014 09:05 PM

Are the unique and total the wrong way around?

Unique / Total Attachments: 2,435 / 2,327


All times are GMT. The time now is 12:17 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.01178 seconds
  • Memory Usage 1,740KB
  • Queries Executed 10 (?)
More Information
Template Usage:
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (1)bbcode_php_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)post_thanks_navbar_search
  • (1)printthread
  • (9)printthreadbit
  • (1)spacer_close
  • (1)spacer_open 

Phrase Groups Available:
  • global
  • postbit
  • showthread
Included Files:
  • ./printthread.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/class_bbcode_alt.php
  • ./includes/class_bbcode.php
  • ./includes/functions_bigthree.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
  • printthread_start
  • bbcode_fetch_tags
  • bbcode_create
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • printthread_post
  • printthread_complete