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
Percentage of PM Quota Used Details »»
Percentage of PM Quota Used
Version: 4.0.1, by ForumsMods ForumsMods is offline
Developer Last Online: Sep 2022 Show Printable Version Email this Page

Category: Private Messages Enhancements - Version: 4.x.x Rating:
Released: 12-16-2010 Last Update: 12-28-2010 Installs: 32
Uses Plugins Auto-Templates
Code Changes Translations  
No support by the author.

Percentage of PM Quota Used 4.0

Description:
It show the percentage of PM quota that the user used.

Installation:
  1. Import "product-pm_percent.xml" as a product, overwrite if it's already installed
  2. Check Stylevars
Where to set option:
Styles & Templates-> Style Manager-> Stylevars-> Private_Messages-> pm_percent
Languages:
- English

History:
17-12-10: v4.0 First Release
29-12-10: v4.0.1 Fixed displayed porcentage

This hack is created for your use free of charge. No payment is requested. However, if you would like to donate money for the work I put in to this hack, a donation would show your appreciation.

Download Now

File Type: xml product-pm_percent.xml (2.3 KB, 50 views)
File Type: xml product-pm_percent-4.0.1.xml (2.3 KB, 84 views)

Screenshots

File Type: png pm_percent.png (5.9 KB, 0 views)

Show Your Support

  • This modification may not be copied, reproduced or published elsewhere without author's permission.

Comments
  #2  
Old 12-17-2010, 10:56 PM
Boofo's Avatar
Boofo Boofo is offline
 
Join Date: Mar 2002
Location: Des Moines, IA (USA)
Posts: 15,776
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

You're percentage seems to be off. It is showing 2 when it should be .013, or .01.

Quote:
You have 13 messages stored, of a total 1,000 allowed. : 2%

This works:
Code:
$totalpmpercent = $vbulletin->userinfo['pmtotal'] / $vbulletin->userinfo['permissions']['pmquota'];
$pmpercent = vb_number_format($totalpmpercent, 2);
Reply With Quote
  #3  
Old 12-18-2010, 02:59 AM
ForumsMods ForumsMods is offline
 
Join Date: Aug 2007
Location: Argentina
Posts: 667
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Originally Posted by Boofo View Post
You're percentage seems to be off. It is showing 2 when it should be .013, or .01.

This works:
Code:
$totalpmpercent = $vbulletin->userinfo['pmtotal'] / $vbulletin->userinfo['permissions']['pmquota'];
$pmpercent = vb_number_format($totalpmpercent, 2);
Hi,
It should be 1.3 but as I am using ceil function which returns the next highest value, it displays 2. I will use vb_number_format in next release.
Reply With Quote
  #4  
Old 12-18-2010, 03:47 AM
Boofo's Avatar
Boofo Boofo is offline
 
Join Date: Mar 2002
Location: Des Moines, IA (USA)
Posts: 15,776
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

13 divided by 1,000 is not 1.3, it is .013. I did a quota percent for my site a while back and have always used the code I posted. With ceil, it would show as .02. Just trying to help.
Reply With Quote
  #5  
Old 12-18-2010, 04:43 AM
ForumsMods ForumsMods is offline
 
Join Date: Aug 2007
Location: Argentina
Posts: 667
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Originally Posted by Boofo View Post
13 divided by 1,000 is not 1.3, it is .013. I did a quota percent for my site a while back and have always used the code I posted. With ceil, it would show as .02. Just trying to help.
No. It is 13 divided by 1000 multiplied by 100.
13 / 1000 * 100 = 1.3
Reply With Quote
  #6  
Old 12-18-2010, 05:08 AM
Boofo's Avatar
Boofo Boofo is offline
 
Join Date: Mar 2002
Location: Des Moines, IA (USA)
Posts: 15,776
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Okay, but that is not the true percentage then. The way I do it doesn't multiply by 100, which is misleading. No offense meant.
Reply With Quote
  #7  
Old 12-18-2010, 05:21 AM
ForumsMods ForumsMods is offline
 
Join Date: Aug 2007
Location: Argentina
Posts: 667
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Originally Posted by Boofo View Post
Okay, but that is not the true percentage then. The way I do it doesn't multiply by 100, which is misleading. No offense meant.
See:
http://en.wikipedia.org/wiki/Percentage
Or use:
http://www.csgnetwork.com/csgpercent.html

13 is what percent of 1000? Result: 1.3 %
Reply With Quote
  #8  
Old 12-18-2010, 05:41 AM
Boofo's Avatar
Boofo Boofo is offline
 
Join Date: Mar 2002
Location: Des Moines, IA (USA)
Posts: 15,776
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

According to your second link, you are 100% right. It still doesn't look right to me, but I can't argue with it anymore. Sorry for my confusion. And here I thought was good in math in school.

Here's what I came up with using your method:
Code:
$pmpercent = vb_number_format($vbulletin->userinfo['pmtotal'] / $vbulletin->userinfo['permissions']['pmquota'] * 100, 2);
Reply With Quote
  #9  
Old 12-18-2010, 01:24 PM
ForumsMods ForumsMods is offline
 
Join Date: Aug 2007
Location: Argentina
Posts: 667
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Originally Posted by Boofo View Post
According to your second link, you are 100% right. It still doesn't look right to me, but I can't argue with it anymore. Sorry for my confusion. And here I thought was good in math in school.

Here's what I came up with using your method:
Code:
$pmpercent = vb_number_format($vbulletin->userinfo['pmtotal'] / $vbulletin->userinfo['permissions']['pmquota'] * 100, 2);
Now it is correct.
Also I am thinking using round function.
Reply With Quote
  #10  
Old 12-18-2010, 01:27 PM
Boofo's Avatar
Boofo Boofo is offline
 
Join Date: Mar 2002
Location: Des Moines, IA (USA)
Posts: 15,776
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Yes, round would be better. And thanks for catching me on the percentage error. I Have been doing it wrong all along, it seems.
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 03:22 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.04223 seconds
  • Memory Usage 2,331KB
  • 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_code
  • (5)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
  • (1)pagenav_pagelink
  • (10)post_thanks_box
  • (10)post_thanks_button
  • (1)post_thanks_javascript
  • (1)post_thanks_navbar_search
  • (10)post_thanks_postbit_info
  • (9)postbit
  • (3)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
  • post_thanks_function_fetch_thanks_end
  • post_thanks_function_thanked_already_start
  • post_thanks_function_thanked_already_end
  • fetch_musername
  • 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