1
coops
Notify of new messges?
  • 2005/7/17 9:27

  • coops

  • Just popping in

  • Posts: 82

  • Since: 2005/6/15


Hi, I have seen threads on how to put a notification of new messages in your theme, but I am using the ipb forum module, which edits core files

Please help so I can change my site!

Here is the way it is done in the user menu, system_blocks.php (edited for the ipb module):

function b_system_user_show()
{
   global 
$xoopsUser;
      global 
$isbb$xoopsDB;
   if (
is_object($xoopsUser)) {
       
$pm_handler =& xoops_gethandler('privmessage');
       
$block = array();
       
$block['lang_youraccount'] = _MB_SYSTEM_VACNT;
       
$block['lang_editaccount'] = _MB_SYSTEM_EACNT;
       
$block['lang_notifications'] = _MB_SYSTEM_NOTIF;
       
$block['uid'] = $xoopsUser->getVar('uid');
       
$block['lang_logout'] = _MB_SYSTEM_LOUT;
       
$criteria = new CriteriaCompo(new Criteria('read_msg'0));
       
$criteria->add(new Criteria('to_userid'$xoopsUser->getVar('uid')));

 
//<<<--------------------------------------------
 //-+- IPB messages new -- Koudadnshi
 //<<<--------------------------------------------
 
if ($isbb)
 {
     list(
$new_messages) = $xoopsDB->fetchRow($xoopsDB->query("SELECT COUNT(*) FROM ".$xoopsDB->prefix("ipb_messages")." WHERE recipient_id = '".$xoopsUser->getVar("uid")."' AND vid='in' AND read_state='0' "));
  
$block['new_messages'] = $new_messages;
 }
 else
  
$block['new_messages'] = $pm_handler->getCount($criteria);  
 
//>>>--------------------------------------------
 
       
$block['lang_inbox'] = _MB_SYSTEM_INBOX;
       
$block['lang_adminmenu'] = _MB_SYSTEM_ADMENU;
       return 
$block;
   }
   return 
false;
}


..........and here is the way they suggest it to be done (without the ipb module)...


Above header:

<{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}>

In page:
<{if 
$msgcount 0}>
<
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">Inboxa>
<{/if}>


Can someone who knows php put this together to make a code that displays the New Message count that I can put anywhere in my theme? Im sure it would only take 10 mins or so...

2
coops
Re: Notify of new messges?
  • 2005/7/18 6:01

  • coops

  • Just popping in

  • Posts: 82

  • Since: 2005/6/15


Ive posted this on the bbpixel forum too. Does nobody know?

3
coops
Re: Notify of new messges?
  • 2005/7/19 11:53

  • coops

  • Just popping in

  • Posts: 82

  • Since: 2005/6/15


Is this the wrong place to ask?

Login

Who's Online

377 user(s) are online (289 user(s) are browsing Support Forums)


Members: 0


Guests: 377


more...

Donat-O-Meter

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

Latest GitHub Commits