I've come up with the below which works on FORUMHOME and SHOWTHREAD.
I want to use this in a lot of templates so would it be better to make it a global variable (if that's possible) or should I just create a long list of preRegisters?
PHP Code:
$currentuserid = $vbulletin->userinfo[userid];
$query = "SELECT * FROM prefix_user WHERE userid = $currentuserid";
$result = $db->query($query);
while($row = $db->fetch_array($result)) {
$a = $row['friendreqcount'];
$b = $row['vmunreadcount'];
$c = $row['socgroupinvitecount'];
$d = $row['socgroupreqcount'];
$e = $row['pcunreadcount'];
$f = $row['vbseo_likes_unread'];
$h = $row['pmunread'];
}
$title_note_count = $a + $b + $c + $d + $e + $f + $h;
vB_Template::preRegister('FORUMHOME',array('title_note_count' => $title_note_count));
vB_Template::preRegister('SHOWTHREAD',array('title_note_count' => $title_note_count));
Thanks for your help!