aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--phpBB/includes/functions_privmsgs.php5
-rw-r--r--tests/functions_privmsgs/get_max_setting_from_group_test.php4
2 files changed, 4 insertions, 5 deletions
diff --git a/phpBB/includes/functions_privmsgs.php b/phpBB/includes/functions_privmsgs.php
index a54d753787..ff962075a8 100644
--- a/phpBB/includes/functions_privmsgs.php
+++ b/phpBB/includes/functions_privmsgs.php
@@ -2158,7 +2158,7 @@ function phpbb_get_max_setting_from_group(\phpbb\db\driver\driver_interface $db,
}
// Get maximum number of allowed recipients
- $sql = 'SELECT MIN(g.group_' . $setting . ') as min_setting, MAX(g.group_' . $setting . ') as max_setting
+ $sql = 'SELECT MAX(g.group_' . $setting . ') as max_setting
FROM ' . GROUPS_TABLE . ' g, ' . USER_GROUP_TABLE . ' ug
WHERE ug.user_id = ' . (int) $user_id . '
AND ug.user_pending = 0
@@ -2167,9 +2167,8 @@ function phpbb_get_max_setting_from_group(\phpbb\db\driver\driver_interface $db,
$row = $db->sql_fetchrow($result);
$db->sql_freeresult($result);
$max_setting = (int) $row['max_setting'];
- $min_setting = (int) $row['min_setting'];
- return ($min_setting > 0) ? $max_setting : 0;
+ return $max_setting;
}
/**
diff --git a/tests/functions_privmsgs/get_max_setting_from_group_test.php b/tests/functions_privmsgs/get_max_setting_from_group_test.php
index 3eb7866802..fbabf1222a 100644
--- a/tests/functions_privmsgs/get_max_setting_from_group_test.php
+++ b/tests/functions_privmsgs/get_max_setting_from_group_test.php
@@ -33,12 +33,12 @@ class phpbb_functions_privmsgs_get_max_setting_from_group_test extends phpbb_dat
static public function get_max_setting_from_group_data()
{
return array(
- array(1, 0, 'message_limit'),
+ array(1, 2, 'message_limit'),
array(2, 2, 'message_limit'),
array(3, 0, 'message_limit'),
array(4, 0, 'message_limit'),
array(5, 2, 'message_limit'),
- array(1, 0, 'max_recipients'),
+ array(1, 4, 'max_recipients'),
array(2, 4, 'max_recipients'),
array(3, 0, 'max_recipients'),
array(4, 5, 'max_recipients'),