2015-01-15, 06:26 AM
Hello,
I discovered small bug in reputation counters in member profile view.
In default, everything is ok like this:
[attachment=33517]
But... if we change thousands separator to space (" ") used in example in Poland, counters are totally buggy:
[attachment=33518]
I looked into the code and problem is that MyBB:
- get SUM of all reputation
- get SUM of reputation from posts
- format reputation from posts
- get reputation from members by subtract posts from sum
From reputation.php:
It's bug, because formatted text should not be used in subtraction (php use only first digit).
Solution:
Use $rep_post_count instead of $rep_posts in last line.
I discovered small bug in reputation counters in member profile view.
In default, everything is ok like this:
[attachment=33517]
But... if we change thousands separator to space (" ") used in example in Poland, counters are totally buggy:
[attachment=33518]
I looked into the code and problem is that MyBB:
- get SUM of all reputation
- get SUM of reputation from posts
- format reputation from posts
- get reputation from members by subtract posts from sum
From reputation.php:
// Figure out how many reps have come from posts / 'general'
// Posts
$query = $db->simple_select("reputation", "COUNT(rid) AS rep_posts", "uid = '".$user['uid']."' AND pid > 0");
$rep_post_count = $db->fetch_field($query, "rep_posts");
$rep_posts = my_number_format($rep_post_count);
// General
// We count how many reps in total, then subtract the reps from posts
$rep_members = my_number_format($total_reputation - $rep_posts);
It's bug, because formatted text should not be used in subtraction (php use only first digit).
Solution:
Use $rep_post_count instead of $rep_posts in last line.