aboutsummaryrefslogtreecommitdiffstats
path: root/phpBB/includes/functions_privmsgs.php
diff options
context:
space:
mode:
authorMeik Sievertsen <acydburn@phpbb.com>2008-04-21 15:10:59 +0000
committerMeik Sievertsen <acydburn@phpbb.com>2008-04-21 15:10:59 +0000
commit91d0c8b3bf41dfed42d8e33595c0e530a431db1c (patch)
tree025fdf94609a4875d691f3580c5bee7ef407f9bc /phpBB/includes/functions_privmsgs.php
parentf2ba40f294d8e9e75a3adb78eedb2dc47633043e (diff)
downloadforums-91d0c8b3bf41dfed42d8e33595c0e530a431db1c.tar
forums-91d0c8b3bf41dfed42d8e33595c0e530a431db1c.tar.gz
forums-91d0c8b3bf41dfed42d8e33595c0e530a431db1c.tar.bz2
forums-91d0c8b3bf41dfed42d8e33595c0e530a431db1c.tar.xz
forums-91d0c8b3bf41dfed42d8e33595c0e530a431db1c.zip
merge again, revisions 8516 to 8525
git-svn-id: file:///svn/phpbb/trunk@8526 89ea8834-ac86-4346-8a33-228a782c2dd0
Diffstat (limited to 'phpBB/includes/functions_privmsgs.php')
-rw-r--r--phpBB/includes/functions_privmsgs.php21
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