Jaxel
Well-known member
The screenshot below shows session activity...

The top is on a user profile page... the bottom is from the members online page. Why does one of them give a link to the page I am browsing, while the bottom one does not? This is my code...

The top is on a user profile page... the bottom is from the members online page. Why does one of them give a link to the page I am browsing, while the bottom one does not? This is my code...
Code:
public static function getSessionActivityDetailsForList(array $activities)
{
$pageSlugs = array();
foreach ($activities AS $activity)
{
if (!empty($activity['params']['page_slug']))
{
$pageSlugs[$activity['params']['page_slug']] = $activity['params']['page_slug'];
}
}
$pageData = array();
if ($pageSlugs = implode(',', $pageSlugs))
{
$pageModel = XenForo_Model::create('EWRcarta_Model_Pages');
$pages = $pageModel->getPagesBySlugs($pageSlugs);
foreach ($pages AS $page)
{
$pageData[$page['page_slug']] = array(
'title' => $page['page_name'],
'url' => XenForo_Link::buildPublicLink('wiki', $page)
);
}
}
$output = array();
foreach ($activities as $key => $activity)
{
$page = false;
if (!empty($activity['params']['page_slug']))
{
$pageSlug = $activity['params']['page_slug'];
if (isset($pageData[$pageSlug]))
{
$page = $pageData[$pageSlug];
}
}
if ($page)
{
$output[$key] = array(new XenForo_Phrase('viewing_wiki'), $page['title'], $page['url'], false);
}
else
{
$output[$key] = new XenForo_Phrase('viewing_wiki');
}
}
return $output;
}