18
This still works.
Create a php file and name it ex_assign.php
ex_assign.php
// $Id$
// FILE :: ex_assign.php
// AUTHOR :: Ryuji AMANO
// WEB :: Ryu's Planning
//
global $xoopsUser, $xoopsModule;
if (is_object($xoopsUser)) {
$pm_handler =& xoops_gethandler('privmessage');
$criteria = new CriteriaCompo(new Criteria('read_msg', 0));
$criteria->add(new Criteria('to_userid', $xoopsUser->getVar('uid')));
$this->assign("ex_new_messages", $pm_handler->getCount($criteria));
}
if ( is_object($xoopsModule) ) {
$this->assign('ex_moduledir', $xoopsModule->getVar('dirname'));
}
?>
Put ex-assign.php inside the THEME folder.
Now call ex_assign.php into theme by placing the below code right after the body statement in the theme.html.
<{include_php file="$xoops_rootpath/themes/YOUR_THEME_NAME_HERE/ex_assign.php"}>
Now place the below code where you want the message alert to go inside the theme.html
<{if $ex_new_messages < 1}>
<a href="<{$xoops_url}>/viewpmsg.php">Private Messagesa>
<{/if}>
<{if $ex_new_messages > 0}>
<{if $smarty.server.SCRIPT_NAME == "/index.php"}>
<script language="javascript" type="text/javascript">
script>
<{/if}>
<a href="<{$xoops_url}>/viewpmsg.php">
<span style="color:#ff6600;"><{$ex_new_messages}>-Message(s)
span>a>
<{/if}>
With this you not only have a Red link saying how many new messages you have, when you return to front page a popup tells you also. If no new messages it just says "Private Message, linking to the inbox.
I am sure someone could clean up and update, but this works in XOOPS 2 XOOPS 2.2 and XOOPS 2.2.3a.