public function onLikeNotification(OW_Event $event) { $params = $event->getParams(); $data = $event->getData(); if ($params['entityType'] != 'user-status') { return; } $userId = $params['userId']; $userService = BOL_UserService::getInstance(); $action = NEWSFEED_BOL_Service::getInstance()->findAction($params['entityType'], $params['entityId']); if (empty($action)) { return; } $actionData = json_decode($action->data, true); $status = empty($actionData['data']['status']) ? $actionData['string'] : empty($actionData['data']['status']) ? null : $actionData['data']['status']; $contentImage = empty($actionData['contentImage']) ? null : $actionData['contentImage']; if (empty($actionData['data']['userId'])) { $cActivities = $this->service->findActivity(NEWSFEED_BOL_Service::SYSTEM_ACTIVITY_CREATE . ':' . $action->id); $cActivity = reset($cActivities); if (empty($cActivity)) { return; } $ownerId = $cActivity->userId; } else { $ownerId = $actionData['data']['userId']; } $url = OW::getRouter()->urlForRoute('newsfeed_view_item', array('actionId' => $action->id)); if ($ownerId != $userId) { $avatar = BOL_AvatarService::getInstance()->getDataForUserAvatars(array($userId), true, true, true, false); $stringKey = empty($status) ? 'newsfeed+email_notifications_empty_status_like' : 'newsfeed+email_notifications_status_like'; $event = new OW_Event('notifications.add', array('pluginKey' => 'newsfeed', 'action' => 'newsfeed-status_like', 'entityType' => 'status_like', 'entityId' => $data['likeId'], 'userId' => $ownerId, 'action' => 'newsfeed-status_like'), array('format' => "text", 'avatar' => $avatar[$userId], 'string' => array('key' => $stringKey, 'vars' => array('userName' => $userService->getDisplayName($userId), 'userUrl' => $userService->getUserUrl($userId), 'status' => UTIL_String::truncate($status, 100, '...'), 'url' => $url)), 'url' => $url, "contentImage" => $contentImage)); OW::getEventManager()->trigger($event); } }