$subscriptions = $this->getSubscriptions();
$subscribers = $this->getSubscribers();
$groups = $this->getGroups();
- $messagesFrom = $this->getMessagesFrom();
- $messagesTo = $this->getMessagesTo();
- $objs = array_merge($subscriptions, $subscribers, $groups, $notices, $messagesFrom, $messagesTo);
+ $objs = array_merge($subscriptions, $subscribers, $groups, $notices);
Event::handle('AppendUserActivityStreamObjects', array($this, &$objs));
return $groups;
}
- function getMessagesTo()
- {
- $msgMap = Message::listGet('to_profile', array($this->user->id));
-
- $messages = $msgMap[$this->user->id];
-
- if (!empty($this->after)) {
- $messages = array_filter($messages, array($this, 'createdAfter'));
- }
-
- return $messages;
- }
-
- function getMessagesFrom()
- {
- $msgMap = Message::listGet('from_profile', array($this->user->id));
-
- $messages = $msgMap[$this->user->id];
-
- if (!empty($this->after)) {
- $messages = array_filter($messages, array($this, 'createdAfter'));
- }
-
- return $messages;
- }
-
function createdAfter($item) {
$created = strtotime((empty($item->created)) ? $item->modified : $item->created);
return ($created >= $this->after);
return true;
}
+ public function onAppendUserActivityStreamObjects(UserActivityStream $uas, array &$objs)
+ {
+ // Messages _from_ the user
+ $msgMap = Message::listGet('from_profile', array($this->user->id));
+ $messages = $msgMap[$uas->user->id];
+ if (!empty($uas->after)) {
+ $messages = array_filter($messages, array($uas, 'createdAfter'));
+ }
+ $objs[] = $messages;
+
+ // Messages _to_ the user
+ $msgMap = Message::listGet('to_profile', array($this->user->id));
+ $messages = $msgMap[$uas->user->id];
+ if (!empty($uas->after)) {
+ $messages = array_filter($messages, array($uas, 'createdAfter'));
+ }
+ $objs[] = $messages;
+
+ return true;
+ }
+
public function onEndPersonalGroupNav(Menu $menu, Profile $target, Profile $scoped=null)
{
if ($scoped instanceof Profile && $scoped->id == $target->id