OK Try...
PHP Code:
if ($vbulletin->userinfo['userid'] > 0 && $vbulletin->userinfo['userid'] != '' || !$vbulletin->userinfo['userid'])
{
require_once(DIR . '/includes/functions_user.php');
$vbulletin->userinfo['avatar_build'] = fetch_avatar_url($vbulletin->userinfo['userid']);
if (empty($vbulletin->userinfo['avatar_build']) || !is_array($vbulletin->userinfo['avatar_build']))
{
$vbulletin->userinfo['avatar_build'] = array($vbulletin->options['wp_forumimagelink'] . 'noavatar.gif');
}
$vbulletin->userinfo['avatar_build'] = '<img src="' . $vbulletin->userinfo['avatar_build'][0] . '"'.iif($vbulletin->userinfo['avatar_build'][1],$vbulletin->userinfo['avatar_build'][1],'').'border="0" alt="Edit Your Avatar" />';
$postsin = array();
$gp = $db->query_read("SELECT p.threadid, t.forumid FROM " . TABLE_PREFIX . "post p LEFT JOIN " . TABLE_PREFIX . "thread t ON(t.threadid = p.threadid) WHERE p.userid = {$vbulletin->userinfo['userid']}");
while ($gpb = $db->fetch_array($gp))
{
if (!$postsin[$gpb['forumid']])
{
$postsin[$gpb['forumid']] = 1;
}
else
{
$postsin[$gpb['forumid']]++;
}
}
$active = array(0);
if (is_array($postsin) && is_array($vbulletin->forumcache))
{
foreach ($postsin as $forumid => $pi)
{
if ($pi > $active[0])
{
$active = array($pi, $forumid);
}
}
}
if (!empty($active[1]))
{
$vbulletin->userinfo['active'] = array($vbulletin->forumcache[$active[1]], $active[0]);
}
else
{
$vbulletin->userinfo['active'] = false;
}
$exec_totalposts = str_replace(',', '', $totalposts);
if ($exec_totalposts < 1)
{
$exec_totalposts = 1;
}
$vbulletin->userinfo['posts'] = vb_number_format($vbulletin->userinfo['posts']);
$jointime = (TIMENOW - $vbulletin->userinfo['joindate']) / 86400;
if ($jointime < 1)
{
$vbulletin->userinfo['postsperday'] = $vbulletin->userinfo['posts'];
}
else
{
$vbulletin->userinfo['postsperday'] = vb_number_format(str_replace(',', '', $vbulletin->userinfo['posts']) / $jointime, 2);
}
$vbulletin->userinfo['postpercent'] = vb_number_format(((str_replace(',', '', $vbulletin->userinfo['posts']) / $exec_totalposts ) * 100),2);
$vbulletin->userinfo['newposts'] = $db->query_first("SELECT COUNT(*) AS newposts FROM " . TABLE_PREFIX . "post WHERE dateline >= '{$vbulletin->userinfo['lastvisit']}' AND visible = '1'");
$vbulletin->userinfo['newposts'] = vb_number_format($vbulletin->userinfo['newposts']['newposts']);
$vbulletin->userinfo['newthreads'] = $db->query_first("SELECT COUNT(*) AS newthreads FROM " . TABLE_PREFIX . "thread WHERE dateline >= '{$vbulletin->userinfo['lastvisit']}' AND visible = '1' AND sticky in(0,1)");
$vbulletin->userinfo['newthreads'] = vb_number_format($vbulletin->userinfo['newthreads']['newthreads']);
$vbulletin->userinfo['lastvisit'] = vbdate($vbulletin->options['timeformat'], $vbulletin->userinfo['lastvisit']) . ', ' . vbdate($vbulletin->options['dateformat'], $vbulletin->userinfo['lastvisit']);
$exec_lastposts = $db->query_first("SELECT COUNT(*) AS lastposts FROM " . TABLE_PREFIX . "post WHERE visible = 1 AND dateline >= ".(TIMENOW - 86400));
$exec_lastposts = vb_number_format($exec_lastposts['lastposts']);
$welcomepanel = fetch_template('forumhome_welcomepanel_' . $vbulletin->options['wp_style']);
}