/** * Fetches the content required by alerts. * * @param array $contentIds * @param XenForo_Model_Alert $model Alert model invoking this * @param integer $userId User ID the alerts are for * @param array $viewingUser Information about the viewing user (keys: user_id, permission_combination_id, permissions) * * @return array */ public function getContentByIds(array $contentIds, $model, $userId, array $viewingUser) { /* @var $userModel XenForo_Model_User */ $userModel = $model->getModelFromCache('XenForo_Model_User'); $visitor = XenForo_Visitor::getInstance()->toArray(); $users = array(); foreach ($contentIds as $key => $contentId) { if ($contentId == $visitor['user_id']) { $users[$visitor['user_id']] = $visitor; unset($contentIds[$key]); break; } } return $users + $userModel->getUsersByIds($contentIds); }
/** * Fetches related content (user profile posts) by IDs * * @param array $contentIds * @param XenForo_Model_Alert $model Alert model invoking this * @param integer $userId User ID the alerts are for * @param array $viewingUser Information about the viewing user (keys: user_id, permission_combination_id, permissions) * * @return array */ public function getContentByIds(array $contentIds, $model, $userId, array $viewingUser) { return $model->getModelFromCache('XenForo_Model_ProfilePost')->getProfilePostsByIds($contentIds, array('join' => XenForo_Model_ProfilePost::FETCH_USER_RECEIVER)); }
/** * Fetches the content required by alerts. * * @param array $contentIds * @param XenForo_Model_Alert $model Alert model invoking this * @param integer $userId User ID the alerts are for * @param array $viewingUser Information about the viewing user (keys: user_id, permission_combination_id, permissions) * * @return array */ public function getContentByIds(array $contentIds, $model, $userId, array $viewingUser) { /* @var $conversationModel XenForo_Model_Conversation */ $conversationModel = $model->getModelFromCache('XenForo_Model_Conversation'); return $conversationModel->getConversationsForUserByIds($userId, $contentIds); }