diff options
author | Meik Sievertsen <acydburn@phpbb.com> | 2008-04-21 13:20:13 +0000 |
---|---|---|
committer | Meik Sievertsen <acydburn@phpbb.com> | 2008-04-21 13:20:13 +0000 |
commit | af8cb0674b0faa338a840b4144b1da66be5dad64 (patch) | |
tree | d5a80291d42ac784b7a248d198985ec871192860 /phpBB/includes/functions_privmsgs.php | |
parent | 9640f5b1083e31f57271c4084e09fc5717f185c6 (diff) | |
download | forums-af8cb0674b0faa338a840b4144b1da66be5dad64.tar forums-af8cb0674b0faa338a840b4144b1da66be5dad64.tar.gz forums-af8cb0674b0faa338a840b4144b1da66be5dad64.tar.bz2 forums-af8cb0674b0faa338a840b4144b1da66be5dad64.tar.xz forums-af8cb0674b0faa338a840b4144b1da66be5dad64.zip |
#24665
git-svn-id: file:///svn/phpbb/branches/phpBB-3_0_0@8521 89ea8834-ac86-4346-8a33-228a782c2dd0
Diffstat (limited to 'phpBB/includes/functions_privmsgs.php')
-rw-r--r-- | phpBB/includes/functions_privmsgs.php | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/phpBB/includes/functions_privmsgs.php b/phpBB/includes/functions_privmsgs.php index bffa64158a..834bcfea51 100644 --- a/phpBB/includes/functions_privmsgs.php +++ b/phpBB/includes/functions_privmsgs.php @@ -1803,4 +1803,25 @@ function message_history($msg_id, $user_id, $message_row, $folder, $in_post_mode return true; } +/** +* Set correct users max messages in PM folder. +* If several group memberships define different amount of messages, the highest will be chosen. +*/ +function set_user_message_limit() +{ + global $user, $db, $config; + + // Get maximum about from user memberships - if it is 0, there is no limit set and we use the maximum value within the config. + $sql = 'SELECT MAX(g.group_message_limit) as max_message_limit + FROM ' . GROUPS_TABLE . ' g, ' . USER_GROUP_TABLE . ' ug + WHERE ug.user_id = ' . $user->data['user_id'] . ' + AND ug.user_pending = 0 + AND ug.group_id = g.group_id'; + $result = $db->sql_query($sql); + $message_limit = (int) $db->sql_fetchfield('max_message_limit'); + $db->sql_freeresult($result); + + $user->data['message_limit'] = (!$message_limit) ? $config['pm_max_msgs'] : $message_limit; +} + ?>
\ No newline at end of file |