aboutsummaryrefslogtreecommitdiffstats
path: root/phpBB
diff options
context:
space:
mode:
authorNathan <exreaction@phpbb.com>2012-07-10 17:41:27 -0500
committerNathan <exreaction@phpbb.com>2012-07-10 17:41:27 -0500
commitb25efd744db56f7565453caccf26630404db07c7 (patch)
treee13a0fca0b60ac149e5282fd0f6f60332f0690ae /phpBB
parent08bdebb0b578df7df7a3fb451691cb927854b84e (diff)
downloadforums-b25efd744db56f7565453caccf26630404db07c7.tar
forums-b25efd744db56f7565453caccf26630404db07c7.tar.gz
forums-b25efd744db56f7565453caccf26630404db07c7.tar.bz2
forums-b25efd744db56f7565453caccf26630404db07c7.tar.xz
forums-b25efd744db56f7565453caccf26630404db07c7.zip
[ticket/8323] Only disable administrative deactivated accounts from receiving PMs
Allow other types of inactive accounts to receive PMs. Remove the banned PM error message and use the string saying they do not have permission (less translation) PHPBB3-8323
Diffstat (limited to 'phpBB')
-rw-r--r--phpBB/includes/functions_privmsgs.php4
-rw-r--r--phpBB/includes/ucp/ucp_pm_compose.php31
-rw-r--r--phpBB/language/en/ucp.php1
-rw-r--r--phpBB/memberlist.php2
-rw-r--r--phpBB/viewtopic.php6
5 files changed, 36 insertions, 8 deletions
diff --git a/phpBB/includes/functions_privmsgs.php b/phpBB/includes/functions_privmsgs.php
index 99db8d816d..f254014a5b 100644
--- a/phpBB/includes/functions_privmsgs.php
+++ b/phpBB/includes/functions_privmsgs.php
@@ -1847,7 +1847,7 @@ function pm_notification($mode, $author, $recipients, $subject, $message, $msg_i
}
// Get the list of users who want to receive notifications, are "normal" and not deactivated, and have a non-blank email address
- $sql = 'SELECT user_id, username, user_type, user_email, user_lang, user_notify_pm, user_notify_type, user_jabber
+ $sql = 'SELECT user_id, username, user_type, user_inactive_reason, user_email, user_lang, user_notify_pm, user_notify_type, user_jabber
FROM ' . USERS_TABLE . '
WHERE ' . $db->sql_in_set('user_id', $recipients);
$result = $db->sql_query($sql);
@@ -1855,7 +1855,7 @@ function pm_notification($mode, $author, $recipients, $subject, $message, $msg_i
$msg_list_ary = array();
while ($row = $db->sql_fetchrow($result))
{
- if ($row['user_notify_pm'] == 1 && $row['user_type'] != USER_IGNORE && $row['user_type'] != USER_INACTIVE && trim($row['user_email']))
+ if ($row['user_notify_pm'] == 1 && $row['user_type'] != USER_IGNORE && !($row['user_type'] == USER_INACTIVE && $row['user_inactive_reason'] == INACTIVE_MANUAL) && trim($row['user_email']))
{
$msg_list_ary[] = array(
'method' => $row['user_notify_type'],
diff --git a/phpBB/includes/ucp/ucp_pm_compose.php b/phpBB/includes/ucp/ucp_pm_compose.php
index 8fc99818f4..0084184c65 100644
--- a/phpBB/includes/ucp/ucp_pm_compose.php
+++ b/phpBB/includes/ucp/ucp_pm_compose.php
@@ -1194,7 +1194,7 @@ function handle_message_list_actions(&$address_list, &$error, $remove_u, $remove
if (sizeof($usernames))
{
$user_id_ary = array();
- user_get_id_name($user_id_ary, $usernames, array(USER_NORMAL, USER_FOUNDER));
+ user_get_id_name($user_id_ary, $usernames, array(USER_NORMAL, USER_FOUNDER, USER_INACTIVE));
// If there are users not existing, we will at least print a notice...
if (!sizeof($user_id_ary))
@@ -1246,6 +1246,33 @@ function handle_message_list_actions(&$address_list, &$error, $remove_u, $remove
}
}
+ // Administrator deactivated users check
+ $sql = 'SELECT user_id
+ FROM ' . USERS_TABLE . '
+ WHERE ' . $db->sql_in_set('user_id', array_keys($address_list['u'])) . '
+ AND user_type = ' . USER_INACTIVE . '
+ AND user_inactive_reason = ' . INACTIVE_MANUAL;
+ $result = $db->sql_query($sql);
+
+ $removed = false;
+ while ($row = $db->sql_fetchrow($result))
+ {
+ $removed = true;
+ unset($address_list['u'][$row['user_id']]);
+ }
+ $db->sql_freeresult($result);
+
+ // print a notice about users not being added who do not want to receive pms
+ if ($removed)
+ {
+ $error[] = $user->lang['PM_USERS_REMOVED_NO_PERMISSION'];
+ }
+
+ if (!sizeof(array_keys($address_list['u'])))
+ {
+ return;
+ }
+
// Check if users have permission to read PMs
$can_read = $auth->acl_get_list(array_keys($address_list['u']), 'u_readpm');
$can_read = (empty($can_read) || !isset($can_read[0]['u_readpm'])) ? array() : $can_read[0]['u_readpm'];
@@ -1269,7 +1296,7 @@ function handle_message_list_actions(&$address_list, &$error, $remove_u, $remove
unset($address_list['u'][$banned_user]);
}
- $error[] = $user->lang['PM_USERS_REMOVED_BANNED'];
+ $error[] = $user->lang['PM_USERS_REMOVED_NO_PERMISSION'];
}
}
}
diff --git a/phpBB/language/en/ucp.php b/phpBB/language/en/ucp.php
index bc21b6b437..8af828935b 100644
--- a/phpBB/language/en/ucp.php
+++ b/phpBB/language/en/ucp.php
@@ -367,7 +367,6 @@ $lang = array_merge($lang, array(
'PM_SENTBOX' => 'Sent messages',
'PM_SUBJECT' => 'Message subject',
'PM_TO' => 'Send to',
- 'PM_USERS_REMOVED_BANNED' => 'Some users couldn’t be added as they are banned.',
'PM_USERS_REMOVED_NO_PERMISSION' => 'Some users couldn’t be added as they do not have permission to read private messages.',
'PM_USERS_REMOVED_NO_PM' => 'Some users couldn’t be added as they have disabled private message receipt.',
'POPUP_ON_PM' => 'Pop up window on new private message',
diff --git a/phpBB/memberlist.php b/phpBB/memberlist.php
index f468d8543a..a69afe36f3 100644
--- a/phpBB/memberlist.php
+++ b/phpBB/memberlist.php
@@ -1698,7 +1698,7 @@ function show_profile($data, $user_notes_enabled = false, $warn_user_enabled = f
// Can this user receive a Private Message?
$can_receive_pm = (
$data['user_type'] != USER_IGNORE && // They must be a "normal" user
- $data['user_type'] != USER_INACTIVE && // They must not be deactivated by the administrator
+ ($data['user_type'] != USER_INACTIVE && $data['user_inactive_reason'] == INACTIVE_MANUAL) && // They must not be deactivated by the administrator
sizeof($auth->acl_get_list($user_id, 'u_readpm')) && // They must be able to read PMs
!sizeof(phpbb_get_banned_user_ids($user_id, false)) && // They must not be permanently banned
(($auth->acl_gets('a_', 'm_') || $auth->acl_getf_global('m_')) || $data['user_allow_pm']) // They must allow users to contact via PM
diff --git a/phpBB/viewtopic.php b/phpBB/viewtopic.php
index e892689a1e..4306ca2f3f 100644
--- a/phpBB/viewtopic.php
+++ b/phpBB/viewtopic.php
@@ -1109,7 +1109,9 @@ while ($row = $db->sql_fetchrow($result))
$id_cache[] = $poster_id;
$user_cache[$poster_id] = array(
- 'user_type' => $row['user_type'],
+ 'user_type' => $row['user_type'],
+ 'user_inactive_reason' => $row['user_inactive_reason'],
+
'joined' => $user->format_date($row['user_regdate']),
'posts' => $row['user_posts'],
'warnings' => (isset($row['user_warnings'])) ? $row['user_warnings'] : 0,
@@ -1499,7 +1501,7 @@ for ($i = 0, $end = sizeof($post_list); $i < $end; ++$i)
// Can this user receive a Private Message?
$can_receive_pm = (
$user_cache[$poster_id]['user_type'] != USER_IGNORE && // They must be a "normal" user
- $user_cache[$poster_id]['user_type'] != USER_INACTIVE && // They must not be deactivated by the administrator
+ ($user_cache[$poster_id]['user_type'] != USER_INACTIVE && $user_cache[$poster_id]['user_inactive_reason'] == INACTIVE_MANUAL) && // They must not be deactivated by the administrator
in_array($poster_id, $can_receive_pm_list) && // They must be able to read PMs
!in_array($poster_id, $permanently_banned_users) && // They must not be permanently banned
(($auth->acl_gets('a_', 'm_') || $auth->acl_getf_global('m_')) || $data['user_allow_pm']) // They must allow users to contact via PM