MyBB Community Forums

Full Version: Reputation Power Plugin Rounding Down to Nearest Whole Number
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
I have installed this plugin (Reputation Power) which gives users increased reputation power depending on their time online, time since registration and number of posts.

However, I would like to make a couple of modifications:

1) It rounds the reputation power down to the nearest whole number, but I want it to round to 2 decimal places, so I'm getting values like this in the drop-down list:

[Image: cf494ed879.png]

I have removed "floor" from the equation which calculates the reputation power but it still seems to round down to the lowest whole number:

$total = $default+(floor((((((TIME_NOW-$mybb->user['regdate'])/60)/60)/24)/$days)))+(floor($mybb->user['postnum']/$posts))+(floor($mybb->user['timeonline']/$online));

(you will find that there are two of these equations and I have removed "floor" from both)

I understand that if I manage to show all the options too 2 decimal places then I will get a huge list of values, which brings me to my second modification.

2) Is it possible to limit it to only show the maximum negative and maximum positive reputation? I have seen this on other websites and it looks like this:

[Image: 51b66eff79.png]

Any help would be great - thanks in advance.

Winky
Place your "total" variable inside an "IF" block and dont display it if the numbers are higher or lower than what you want to show.

if (total < 0 || total > 10) {
     total = "";
}

Is that what your looking for ? If not, maybe it might help.
(2013-11-09, 10:11 AM)MYSQLi Wrote: [ -> ]Place your "total" variable inside an "IF" block and dont display it if the numbers are higher or lower than what you want to show.

if (total < 0 || total > 10) {
     total = "";
}

Is that what your looking for ? If not, maybe it might help.

The reputation power will vary from user to user so I can't restrain the powers to display to a specific range as this would be something that is variable depending on the user. Maybe it would be easier to achieve this if the value of the default reputation (i.e. +1 and -1) can be replaced with the $total variable rather that adding more values to the list of numbers to rep/neg someone with. No idea how to do this either so any ideas would be appreciated.