14
Hack made by Shank... so al the credits go to him.
Save this code as insert.pms.php in the class/smarty/plugins/ folder
function smarty_insert_pms()
{
GLOBAL $xoopsUser;
$pm_handler =& xoops_gethandler('privmessage');
$uid = $xoopsUser->getVar('uid');
$criteria = new CriteriaCompo(new Criteria('read_msg', 0));
$criteria->add(new Criteria('to_userid', $uid));
$msgcount = $pm_handler->getCount($criteria);
$GLOBALS['xoopsTpl']->assign('msgcount', $msgcount);
}
?>
and in your theme.html this code wherever you want the alert to show.
<{insert name="pms"}>
<a href="<{$xoops_url}>/viewpmsg.php">
<{if $msgcount > 0}>
<{if $msgcount > 1}>You Have <{$msgcount}> New Messages
<{else}>You have <{$msgcount}> New Message
<{/if}>
<{else}>Private Messages
<{/if}>a>