aboutsummaryrefslogtreecommitdiffstats
path: root/phpBB/includes/notifications
diff options
context:
space:
mode:
authorNathan Guse <nathaniel.guse@gmail.com>2012-09-08 12:05:55 -0500
committerNathan Guse <nathaniel.guse@gmail.com>2012-09-08 12:05:55 -0500
commite45fb0025ec8c27147caee7e3c14902f2e3f02c5 (patch)
tree76dd5547683c771e3b221cbec5f7c392fa01a216 /phpBB/includes/notifications
parent44f07df96fbf933bc20166a516bf0eecee00df4c (diff)
downloadforums-e45fb0025ec8c27147caee7e3c14902f2e3f02c5.tar
forums-e45fb0025ec8c27147caee7e3c14902f2e3f02c5.tar.gz
forums-e45fb0025ec8c27147caee7e3c14902f2e3f02c5.tar.bz2
forums-e45fb0025ec8c27147caee7e3c14902f2e3f02c5.tar.xz
forums-e45fb0025ec8c27147caee7e3c14902f2e3f02c5.zip
[ticket/11103] Output the notifications to the template
For now, just dumping the notifications in the header. PHPBB3-11103
Diffstat (limited to 'phpBB/includes/notifications')
-rw-r--r--phpBB/includes/notifications/service.php4
-rw-r--r--phpBB/includes/notifications/type/base.php15
-rw-r--r--phpBB/includes/notifications/type/post.php13
3 files changed, 27 insertions, 5 deletions
diff --git a/phpBB/includes/notifications/service.php b/phpBB/includes/notifications/service.php
index fd2c51a330..8db414cb16 100644
--- a/phpBB/includes/notifications/service.php
+++ b/phpBB/includes/notifications/service.php
@@ -87,14 +87,14 @@ class phpbb_notifications_service
while ($row = $this->db->sql_fetchrow($result))
{
- $type_class_name = $this->get_type_class_name($row['type'], true);
+ $type_class_name = $this->get_type_class_name($row['item_type'], true);
$notification = new $type_class_name($this->phpbb_container, $row);
$notification->users($this->users);
$user_ids = array_merge($user_ids, $notification->users_to_query());
- $notifications[] = $notification();
+ $notifications[] = $notification;
}
$this->db->sql_freeresult($result);
diff --git a/phpBB/includes/notifications/type/base.php b/phpBB/includes/notifications/type/base.php
index 2b194557e3..1b01e1d46c 100644
--- a/phpBB/includes/notifications/type/base.php
+++ b/phpBB/includes/notifications/type/base.php
@@ -85,7 +85,7 @@ abstract class phpbb_notifications_type_base implements phpbb_notifications_type
*/
protected function get_data($name)
{
- return $this->data['data'][$name];
+ return (isset($this->data['data'][$name])) ? $this->data['data'][$name] : null;
}
/**
@@ -105,7 +105,18 @@ abstract class phpbb_notifications_type_base implements phpbb_notifications_type
*/
public function users(&$users)
{
- $this->users = $users;
+ $this->users = &$users;
+ }
+
+ /**
+ * Get a user row from our users cache
+ *
+ * @param int $user_id
+ * @return array
+ */
+ protected function get_user($user_id)
+ {
+ return $this->users[$user_id];
}
/**
diff --git a/phpBB/includes/notifications/type/post.php b/phpBB/includes/notifications/type/post.php
index 08da7a77cb..4b343650a1 100644
--- a/phpBB/includes/notifications/type/post.php
+++ b/phpBB/includes/notifications/type/post.php
@@ -37,7 +37,18 @@ class phpbb_notifications_type_post extends phpbb_notifications_type_base
*/
public function get_title()
{
- return $this->data['post_username'] . ' posted in the topic ' . censor_text($this->data['topic_title']);
+ if ($this->get_data('post_username'))
+ {
+ $username = $this->get_data('post_username');
+ }
+ else
+ {
+ $user_data = $this->get_user($this->get_data('poster_id'));
+
+ $username = get_username_string('no_profile', $user_data['user_id'], $user_data['username'], $user_data['user_colour']);
+ }
+
+ return $username . ' posted in the topic ' . censor_text($this->get_data('topic_title'));
}
/**