The Arcive of Official vBulletin Modifications Site.It is not a VB3 engine, just a parsed copy! |
|
#1
|
||||
|
||||
![]()
Hey everyone. I ported over the calculation that was used often in vB2 to calculate Active/NonActive members and the Activity %, and I remember having problems with it before with the percentage displaying a massive negative number after months of working properly before. I just simply removed the hack and forgot about the glitch, but now that I'm using it again I've decided to ask here on advice to how to fix it.
Basically when the member count goes above 1000 the calculation screws up: Quote:
Here is my PHP Code for the calculation of the stat: PHP Code:
|
#2
|
||||
|
||||
![]()
Anyone? The stat is looking very weird currently.
|
#3
|
||||
|
||||
![]()
Please? I'm lost here.
![]() |
#4
|
||||
|
||||
![]()
Try this for the percentage:
PHP Code:
|
#5
|
||||
|
||||
![]() Quote:
![]() The thing is I doubt the problem is in the percentage calculation. As you can see the Active Members number is screwed up, while the Inactive one isn't. Since the Active members calculation is TotalMembers - InactiveMembers it could be related to the Total Member variable. Thing is though if I put $numbermembers ONLY it works right (displays 1000) while if I just put $nonposters it also works right (displays 378). BUT when you put them together in a calculation it treats the $numbermembers variable is only being 1. Not 1000. So 1-378 is -377 which is weird. I've tried other random calculations and all the time it treats that variable as 1 and not 1000, but if I stick it there on it's own it displays 1000. This is just so totally random. Anything else? Since $numbermembers is a normal variable on the forums, not one added by the hack it makes things worse... :-\ |
#6
|
||||
|
||||
![]()
Try doing the calculation with the following. This is what I use on my site.
HTML Code:
vb_number_format(($numbermembers / $newuserid) * 100, 2 ); |
#7
|
||||
|
||||
![]() Quote:
![]() PHP Code:
Quote:
|
#8
|
||||
|
||||
![]()
How many members do you have? And what is the newest member's userid?
Here is the code I use in my forumhome stats hack on myy site and it works like it is supposed to: PHP Code:
Quote:
|
#9
|
||||
|
||||
![]() Quote:
The latest UserID is 1064, which just means that we've deleted 2 members since the beginning. To 1062/1064 I'm surprised gives you the correct answer. Our users are only active if they've posted at least once. To the first line Queries the database getting the number of users with 0 posts. The second line assigns that number to $nonposters. Third line calculates the Active members by subtracting the Non Posters from the Total Members, then finally the last line calculates the Active User Percentage by dividing the Active Users into the Total Member Count. That makes sense, and it's worked, but when it reached 1000 members it screws up. As though it overflows the variable or something. I'm not sure. But one thing I have done that's worked is sticking in the Member count manually into the calculations. Like instead of $numbermembers I put 1062 and it works fine, but the variable doesn't. |
#10
|
||||
|
||||
![]()
Try using my calculation code all by itself, without your other code above it, and tell me if it is right then.
![]() |
![]() |
|
|
X vBulletin 3.8.12 by vBS Debug Information | |
---|---|
|
|
![]() |
|
Template Usage:
Phrase Groups Available:
|
Included Files:
Hooks Called:
|