SmartFAQ is developed by The SmartFactory (https://www.smartfactory.ca), a division of InBox Solutions (https://www.inboxsolutions.net)

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


The comments are owned by the author. We aren't responsible for their content.
Author
Thread
user

 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:


<{if $xoops_isuser}>
<{php}>
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}>

 
Top Parent
Replies
Author
Published


Login

Who's Online

127 user(s) are online (1 user(s) are browsing XOOPS FAQ)


Members: 0


Guests: 127


more...

Donat-O-Meter

Stats
Goal: $100.00
Due Date: May 31
Gross Amount: $0.00
Net Balance: $0.00
Left to go: $100.00
Make donations with PayPal!

Did you know ?

you can add your own content in a custom block?

Random question

What is the difference between a Comment and a Post in the forum?