Skip to content

Commit 51ac2b7

Browse files
committed
Fix bug with max/min reputation
1 parent 4a8b855 commit 51ac2b7

1 file changed

Lines changed: 17 additions & 8 deletions

File tree

root/includes/functions_reputation.php

Lines changed: 17 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -312,7 +312,10 @@ function give_point($to, $post_id = 0, $comment, $notify = false, $point, $mode
312312
$db->sql_query($sql);
313313

314314
///Check max/min points
315-
$this->check_point($to);
315+
if ($config['rs_max_point'] || $config['rs_min_point'])
316+
{
317+
$this->check_point($to);
318+
}
316319

317320
//If config allows and we are told so, we should send a private message to a user, who received the vote
318321
if ($notify && $config['rs_pm_notify'])
@@ -381,11 +384,6 @@ private function check_point($user_id)
381384
{
382385
global $config, $db;
383386

384-
if (!$config['rs_max_point'] || !$config['rs_min_point'])
385-
{
386-
return;
387-
}
388-
389387
$sql = 'SELECT SUM(point) AS points
390388
FROM ' . REPUTATIONS_TABLE . "
391389
WHERE action != 5
@@ -402,6 +400,7 @@ private function check_point($user_id)
402400
WHERE user_id = $user_id";
403401
$db->sql_query($sql);
404402
}
403+
405404
//Min user reputation
406405
if ($config['rs_min_point'] && ($config['rs_min_point'] > $points['points']))
407406
{
@@ -460,8 +459,13 @@ function delete($id)
460459
WHERE user_id = {$row['rep_to']}";
461460
$db->sql_query($sql);
462461

462+
global $config;
463+
463464
//Check max/min points
464-
$this->check_point($row['rep_to']);
465+
if ($config['rs_max_point'] || $config['rs_min_point'])
466+
{
467+
$this->check_point($row['rep_to']);
468+
}
465469
}
466470

467471
//Update new status field
@@ -526,8 +530,13 @@ function clear_reputation($mode, $id, $post_ids = array())
526530
WHERE user_id = {$point['rep_to']}";
527531
$db->sql_query($sql);
528532

533+
global $config;
534+
529535
//Check max/min points
530-
$this->check_point($point['rep_to']);
536+
if ($config['rs_max_point'] || $config['rs_min_point'])
537+
{
538+
$this->check_point($point['rep_to']);
539+
}
531540
}
532541

533542
$sql = 'SELECT topic_id, forum_id, post_subject

0 commit comments

Comments
 (0)