1
mikelmoore
PM System Notification hack
  • 2006/3/27 23:55

  • mikelmoore

  • Just popping in

  • Posts: 3

  • Since: 2005/2/23


If you are using the Private Messaging module and want the notifications back, modify the b_system_user_show function in system_blocks.php like this. Adjust 'auto-notify' text in the SELECT statement for your language.

This hack shouldn't cause any problems even if you don't have Private Messaging installed...

I updated this to only count unread notifications,cleaned up formatting and added comments...

function b_system_user_show()
{
global 
$xoopsUser;
//Need to access database & check module install state, so get their handles
$xoopsDB =& Database::getInstance();
$module_handler =& xoops_gethandler('module');
if (
is_object($xoopsUser)) {
    
$block = array();
    
$block['lang_youraccount'] = _MB_SYSTEM_VACNT;
    
$block['lang_editaccount'] = _MB_SYSTEM_EACNT;
    
//see if private messaging is installed
    
if ($module_handler->getCount(new Criteria('dirname''pm'))) {
        
//get count of any unread notifications
        
$result $xoopsDB->query("SELECT COUNT(*) FROM " $xoopsDB->prefix("priv_msgs")." WHERE to_userid = "$xoopsUser->getVar('uid') . " AND read_msg = 0 AND INSTR(subject,'auto-notify') > 0");
        
//if there are any notifications
        
if ( $result ) {
            
$privmsgcnt $xoopsDB->fetchRow($result);
            
//if there are any unread notifications
            
if ( $privmsgcnt[0] > ) {
                
$block['lang_notifications'] = _MB_SYSTEM_NOTIF " (" $privmsgcnt[0] . ")";
            
//if there aren't any unread notifications
            
} else {
                
$block['lang_notifications'] = _MB_SYSTEM_NOTIF;
            }
        } else {
            
$block['lang_notifications'] = _MB_SYSTEM_NOTIF;
        }
    
//Private Messaging not installed
    
} else {
        
$block['lang_notifications'] = _MB_SYSTEM_NOTIF;
    }
    
$block['lang_logout'] = _MB_SYSTEM_LOUT;
    
$block['lang_adminmenu'] = _MB_SYSTEM_ADMENU;
    
$block['admin'] = $xoopsUser->isAdmin(0);
    return 
$block;
}
return 
false;
}

Login

Who's Online

394 user(s) are online (41 user(s) are browsing Support Forums)


Members: 0


Guests: 394


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