Log in

View Full Version : Private Messages Enhancements - Percentage of PM Quota Used


ForumsMods
12-16-2010, 10:00 PM
Percentage of PM Quota Used 4.0

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

Installation:

Import "product-pm_percent.xml" as a product, overwrite if it's already installed
Check StylevarsWhere 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.

Boofo
12-17-2010, 10:56 PM
You're percentage seems to be off. It is showing 2 when it should be .013, or .01.

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


This works:
$totalpmpercent = $vbulletin->userinfo['pmtotal'] / $vbulletin->userinfo['permissions']['pmquota'];
$pmpercent = vb_number_format($totalpmpercent, 2);

ForumsMods
12-18-2010, 02:59 AM
You're percentage seems to be off. It is showing 2 when it should be .013, or .01.

This works:
$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.

Boofo
12-18-2010, 03:47 AM
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. ;)

ForumsMods
12-18-2010, 04:43 AM
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

Boofo
12-18-2010, 05:08 AM
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. ;)

ForumsMods
12-18-2010, 05:21 AM
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 %

Boofo
12-18-2010, 05:41 AM
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:
$pmpercent = vb_number_format($vbulletin->userinfo['pmtotal'] / $vbulletin->userinfo['permissions']['pmquota'] * 100, 2);

ForumsMods
12-18-2010, 01:24 PM
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:
$pmpercent = vb_number_format($vbulletin->userinfo['pmtotal'] / $vbulletin->userinfo['permissions']['pmquota'] * 100, 2);
Now it is correct.
Also I am thinking using round function.

Boofo
12-18-2010, 01:27 PM
Yes, round would be better. And thanks for catching me on the percentage error. I Have been doing it wrong all along, it seems. ;)

Harley D
12-20-2010, 06:29 PM
Has the code been updated to reflect the proper percentage?
Is it possible to move the display to the top? Mine currently shows at the bottom.

Thanks

fishwestend
01-15-2011, 08:57 PM
Any updates?

ForumsMods
01-15-2011, 09:07 PM
Any updates?
As in thread description 4.0.1 version was released with the correct porcentage.

fishwestend
01-16-2011, 01:08 AM
Thanks, must have missed that. Anyway of moving the Folder Controls which shows the percentage above the Inbox and full list of PM's?

bosanci28
10-27-2014, 02:37 PM
I know that this is old tread, but can this be displayed at top? also possible to notify the user ,with a email that his mail box is getting closed to be full? Using vb4.2.1.

Thanks

stevieb
10-29-2014, 10:57 PM
Does this work on 4.2 patch1?