1
deka87
Any smarty plugin to display pm counter in a template?
  • 2012/8/15 6:38

  • deka87

  • Friend of XOOPS

  • Posts: 1124

  • Since: 2007/10/5


Hi guys,

As for now I use this in userinfo.php :

// ======== Private messages counter ============
    
$criteria = new CriteriaCompo(new Criteria('read_msg'0));
    
$criteria->add(new Criteria('to_userid'$xoopsUser->getVar('uid')));

    
$pm_handler =& xoops_gethandler('privmessage');
    
$pm_counter $pm_handler->getCount($criteria);
    
$xoopsTpl->assign'pm_counter'$pm_counter );


To render <{pm_counter}> on the profile page. Is there any ready smarty plugin to render the number of pm messages in the theme.html directly?

thanks in advance!

2
irmtfan
Re: Any smarty plugin to display pm counter in a template?
  • 2012/8/15 7:19

  • irmtfan

  • Module Developer

  • Posts: 3419

  • Since: 2003/12/7


I use the multimenu module in my website and it can show these
look here:
https://xoops.org/modules/repository/s ... m_order=1&lid=1787&cid=89

Quote:

You can use {user_id} in your link. It will retrieve the Id of the user seing the page
ex:

userinfo?uid={user_id}

You can also customize the name of the link for display private messages info

In the tab title just add
{pm_new}
{pm_readed}
{pm_total}

ex:

title = Inbox {pm_new}
Link to = viewpmsg.php


but you should implement these smarties from Mytab in userinfo.php yourself.

3
mjoel
Re: Any smarty plugin to display pm counter in a template?
  • 2012/8/15 10:58

  • mjoel

  • Quite a regular

  • Posts: 325

  • Since: 2006/12/9



4
zyspec
Re: Any smarty plugin to display pm counter in a template?
  • 2012/8/16 0:15

  • zyspec

  • Module Developer

  • Posts: 1093

  • Since: 2004/9/21


<{xoInboxCount}> will display the number new PMs for any logged in user. The code in the post that mjoel pointed to has a good example of how to assign the value to a variable ('pmcount' in the example) if you want to get the number and do something with it - for example only print out a message if there are PMs waiting, change the display CSS, etc...

5
deka87
Re: Any smarty plugin to display pm counter in a template?
  • 2012/8/16 5:50

  • deka87

  • Friend of XOOPS

  • Posts: 1124

  • Since: 2007/10/5


Thanks guys, <{xoInboxCount assign=pmcount}> is really what I was looking for. Th only problem it doesn't update at once when a new message has been read. But that seems okay anyways.

Login

Who's Online

52 user(s) are online (27 user(s) are browsing Support Forums)


Members: 0


Guests: 52


more...

Donat-O-Meter

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

Latest GitHub Commits