3
Here is another one. I scooped most of the code from a similar thread yesterday. I turned on the smarty debug to catch variable names I needed. It will print a Logout link if logged in otherwise place a Register link.
It checks their Inbox and will show a new message count in red if any otherwise just a link to the Inbox.
I put this in my theme.html file, actually it is a text file and I do an <{include ... }> so I can use it in other themes.
<{if $xoops_isuser}>
<a href="<{$xoops_url}>/user.php?op=logout">Bye</a> · User: <a href="<{$xoops_url}>/user.php"><{$xoops_uname}></a> ·
<{php}>
/* ******* User Details if Logged In ******* */
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);
<{/php}>
<{if $msgcount > 0}>
<a class="highlight" href="<{$xoops_url}>/viewpmsg.php">Inbox (<span style="color:#ff0000; font-weight: bold;"><{$msgcount}></span>)</a>
<{else}>
<a href="<{$xoops_url}>/viewpmsg.php">Inbox</a>
<{/if}>
<{else}>
<a href="<{$xoops_url}>/register.php">Register</a>
<{/if}>