How can I make a block to show my PMs ?

Requested and Answered by Carnuke on 2005/1/24 21:10:00

How can I make a block to show my PMs ?

make a php custom block with the following code;

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 
"/viewpmsg.php" title="Read your new Private Messages">Private Messages ($pm)n";
}
else
{
  echo 
"No new Private Messagesn";
}

This Q&A was found on XOOPS Web Application System : https://xoops.org/modules/smartfaq/faq.php?faqid=377