aboutsummaryrefslogtreecommitdiffstats
path: root/phpBB/viewtopic.php
diff options
context:
space:
mode:
authorNathan <exreaction@phpbb.com>2012-07-04 10:34:09 -0500
committerNathan <exreaction@phpbb.com>2012-07-10 12:34:39 -0500
commit6f4538c676ebd3b6e299a606a04f672698ebc487 (patch)
treee0b8d2546d287d267872ed0888f7662d0b9a8467 /phpBB/viewtopic.php
parente6d4e9bbb98feaee7a413967d6500163ebe7282c (diff)
downloadforums-6f4538c676ebd3b6e299a606a04f672698ebc487.tar
forums-6f4538c676ebd3b6e299a606a04f672698ebc487.tar.gz
forums-6f4538c676ebd3b6e299a606a04f672698ebc487.tar.bz2
forums-6f4538c676ebd3b6e299a606a04f672698ebc487.tar.xz
forums-6f4538c676ebd3b6e299a606a04f672698ebc487.zip
[ticket/8323] Hide the Send PM link if users cannot receive the PM
Updated memberlist/viewtopic to the new rules PHPBB3-8323
Diffstat (limited to 'phpBB/viewtopic.php')
-rw-r--r--phpBB/viewtopic.php14
1 files changed, 13 insertions, 1 deletions
diff --git a/phpBB/viewtopic.php b/phpBB/viewtopic.php
index b75f4aeccf..10ec6f4ee7 100644
--- a/phpBB/viewtopic.php
+++ b/phpBB/viewtopic.php
@@ -16,6 +16,7 @@ $phpEx = substr(strrchr(__FILE__, '.'), 1);
include($phpbb_root_path . 'common.' . $phpEx);
include($phpbb_root_path . 'includes/functions_display.' . $phpEx);
include($phpbb_root_path . 'includes/bbcode.' . $phpEx);
+include($phpbb_root_path . 'includes/functions_user.' . $phpEx);
// Start session management
$user->session_begin();
@@ -1108,6 +1109,7 @@ while ($row = $db->sql_fetchrow($result))
$id_cache[] = $poster_id;
$user_cache[$poster_id] = array(
+ 'user_type' => $row['user_type'],
'joined' => $user->format_date($row['user_regdate']),
'posts' => $row['user_posts'],
'warnings' => (isset($row['user_warnings'])) ? $row['user_warnings'] : 0,
@@ -1315,6 +1317,13 @@ if ($bbcode_bitfield !== '')
$bbcode = new bbcode(base64_encode($bbcode_bitfield));
}
+// Get the list of users who can receive private messages
+$can_receive_pm_list = $auth->acl_get_list(array_keys($user_cache), 'u_readpm');
+$can_receive_pm_list = (empty($can_receive_pm_list) || !isset($can_receive_pm_list[0]['u_readpm'])) ? array() : $can_receive_pm_list[0]['u_readpm'];
+
+// Get the list of banned users
+$banned_users = phpbb_get_banned_user_ids(array_keys($user_cache));
+
$i_total = sizeof($rowset) - 1;
$prev_post_id = '';
@@ -1487,6 +1496,9 @@ for ($i = 0, $end = sizeof($post_list); $i < $end; ++$i)
!$row['post_edit_locked']
)));
+ // Can this user receive a Private Message?
+ $can_receive_pm = ($user_cache[$poster_id]['user_type'] <> USER_IGNORE && (($auth->acl_gets('a_', 'm_') || $auth->acl_getf_global('m_')) || ($user_cache[$poster_id]['allow_pm'] && in_array($poster_id, $can_receive_pm_list) && !in_array($poster_id, $banned_users))) ? true : false;
+
//
$postrow = array(
'POST_AUTHOR_FULL' => ($poster_id != ANONYMOUS) ? $user_cache[$poster_id]['author_full'] : get_username_string('full', $poster_id, $row['username'], $row['user_colour'], $row['post_username']),
@@ -1527,7 +1539,7 @@ for ($i = 0, $end = sizeof($post_list); $i < $end; ++$i)
'U_PROFILE' => $user_cache[$poster_id]['profile'],
'U_SEARCH' => $user_cache[$poster_id]['search'],
- 'U_PM' => ($poster_id != ANONYMOUS && $config['allow_privmsg'] && $auth->acl_get('u_sendpm') && ($user_cache[$poster_id]['allow_pm'] || $auth->acl_gets('a_', 'm_') || $auth->acl_getf_global('m_'))) ? append_sid("{$phpbb_root_path}ucp.$phpEx", 'i=pm&amp;mode=compose&amp;action=quotepost&amp;p=' . $row['post_id']) : '',
+ 'U_PM' => ($config['allow_privmsg'] && $auth->acl_get('u_sendpm') && $can_receive_pm) ? append_sid("{$phpbb_root_path}ucp.$phpEx", 'i=pm&amp;mode=compose&amp;action=quotepost&amp;p=' . $row['post_id']) : '',
'U_EMAIL' => $user_cache[$poster_id]['email'],
'U_WWW' => $user_cache[$poster_id]['www'],
'U_ICQ' => $user_cache[$poster_id]['icq'],