From 43e3af4b46bdfe0935c766489a66c5c0f8786e3f Mon Sep 17 00:00:00 2001 From: Nathan Guse Date: Fri, 12 Oct 2012 11:37:51 -0500 Subject: [PATCH] [ticket/11103] Notification grouping output for posts. PHPBB3-11103 --- phpBB/includes/notification/type/post.php | 54 ++++++++++++++++++----- 1 file changed, 44 insertions(+), 10 deletions(-) diff --git a/phpBB/includes/notification/type/post.php b/phpBB/includes/notification/type/post.php index a2b1fbf82a..d6f6c16e59 100644 --- a/phpBB/includes/notification/type/post.php +++ b/phpBB/includes/notification/type/post.php @@ -171,20 +171,36 @@ class phpbb_notification_type_post extends phpbb_notification_type_base */ public function get_title() { - if ($this->get_data('post_username')) - { - $username = $this->get_data('post_username'); - } - else - { - $user_data = $this->notification_manager->get_user($this->get_data('poster_id')); + $responders = $this->get_data('responders'); + $usernames = array(); - $username = get_username_string('no_profile', $user_data['user_id'], $user_data['username'], $user_data['user_colour']); + if (!is_array($responders)) + { + $responders = array(); + } + + $responders = array_merge(array(array( + 'poster_id' => $this->get_data('poster_id'), + 'username' => $this->get_data('post_username'), + )), $responders); + + foreach ($responders as $responder) + { + if ($responder['username']) + { + $usernames[] = $responder['username']; + } + else + { + $user_data = $this->notification_manager->get_user($responder['poster_id']); + + $usernames[] = get_username_string('no_profile', $user_data['user_id'], $user_data['username'], $user_data['user_colour']); + } } return $this->user->lang( $this->language_key, - $username, + implode(', ', $usernames), censor_text($this->get_data('topic_title')) ); } @@ -226,7 +242,25 @@ class phpbb_notification_type_post extends phpbb_notification_type_base */ public function users_to_query() { - return array($this->data['poster_id']); + /*$responders[] = array( + 'poster_id' => $post['poster_id'], + 'username' => (($post['poster_id'] == ANONYMOUS) ? $post['post_username'] : ''), + );*/ + + $responders = $this->get_data('responders'); + $users = array( + $this->get_data('poster_id'), + ); + + if (is_array($responders)) + { + foreach ($responders as $responder) + { + $users[] = $responder['poster_id']; + } + } + + return $users; } /**