aboutsummaryrefslogtreecommitdiffstats
path: root/phpBB/phpbb
diff options
context:
space:
mode:
authorNathan Guse <nathaniel.guse@gmail.com>2013-11-21 13:27:52 -0800
committerNathan Guse <nathaniel.guse@gmail.com>2013-11-21 13:27:52 -0800
commit20885ccb8cef8d497ceacc232d3d864d5c07c455 (patch)
tree1ecd705ee6807d337f70fa2719be53fc4424702c /phpBB/phpbb
parent6403d6848e6d1c325ccc5f487d4747f42151708d (diff)
parente3a28e5e2a451794b322be90e1aef9ad4aee256b (diff)
downloadforums-20885ccb8cef8d497ceacc232d3d864d5c07c455.tar
forums-20885ccb8cef8d497ceacc232d3d864d5c07c455.tar.gz
forums-20885ccb8cef8d497ceacc232d3d864d5c07c455.tar.bz2
forums-20885ccb8cef8d497ceacc232d3d864d5c07c455.tar.xz
forums-20885ccb8cef8d497ceacc232d3d864d5c07c455.zip
Merge pull request #1882 from prototech/ticket/11959
[ticket/11959] Trim the list of users from post notifications.
Diffstat (limited to 'phpBB/phpbb')
-rw-r--r--phpBB/phpbb/notification/type/post.php33
1 files changed, 30 insertions, 3 deletions
diff --git a/phpBB/phpbb/notification/type/post.php b/phpBB/phpbb/notification/type/post.php
index c0ef184a19..c2854c17af 100644
--- a/phpBB/phpbb/notification/type/post.php
+++ b/phpBB/phpbb/notification/type/post.php
@@ -183,6 +183,10 @@ class post extends \phpbb\notification\type\base
'username' => $this->get_data('post_username'),
)), $responders);
+ $responders_cnt = sizeof($responders);
+ $responders = $this->trim_user_ary($responders);
+ $trimmed_responders_cnt = $responders_cnt - sizeof($responders);
+
foreach ($responders as $responder)
{
if ($responder['username'])
@@ -194,11 +198,18 @@ class post extends \phpbb\notification\type\base
$usernames[] = $this->user_loader->get_username($responder['poster_id'], 'no_profile');
}
}
+ $lang_key = $this->language_key;
+
+ if ($trimmed_responders_cnt)
+ {
+ $lang_key .= '_TRIMMED';
+ }
return $this->user->lang(
- $this->language_key,
- implode(', ', $usernames),
- censor_text($this->get_data('topic_title'))
+ $lang_key,
+ implode($this->user->lang['COMMA_SEPARATOR'], $usernames),
+ censor_text($this->get_data('topic_title')),
+ $trimmed_responders_cnt
);
}
@@ -272,6 +283,22 @@ class post extends \phpbb\notification\type\base
}
}
+ return $this->trim_user_ary($users);
+ }
+
+ /**
+ * Trim the user array passed down to 3 users if the array contains
+ * more than 4 users.
+ *
+ * @param array $users Array of users
+ * @return array Trimmed array of user_ids
+ */
+ public function trim_user_ary($users)
+ {
+ if (sizeof($users) > 4)
+ {
+ array_splice($users, 3);
+ }
return $users;
}