global $xoopsUser;
if( $xoopsUser )
{
$pm_handler =& xoops_gethandler('privmessage');
$criteria = new CriteriaCompo(new Criteria('read_msg', 0));
$criteria->add(new Criteria('to_userid', $xoopsUser->getVar('uid')));
$pm = $pm_handler->getCount($criteria);
}
if( $pm )
{
echo "<a href="/viewpmsg.php" title="Read your new Private Messages">Private Messages ($pm)</a>n";
}
else
{
echo "No new Private Messagesn";
}
|
Re: using inbox waring global
Also, you will need to wrap the PHP with the ifuser statement, otherwise non logged in users will have problems with the page not being rendered.
Quote: