Open system/lib-custom.php. At the bottom before the php close tag ( ?> ) add the following.
Text Formatted Code
function phpblock_newmessages() {
global $_USER, $_CONF, $_TABLES, $LANG_MSG00, $CONF_MSG;
// If restricted access has been enabled in the plugins config.php then check access right
$retval = "";
if ($_USER['uid'] > 1 AND (!$CONF_MSG['RestrictedAccess'] OR SEC_hasRights('messenger.user')) ) {
// Check and see if user wants to view Broadcast messages - if not exclude them
if (DB_getItem($_TABLES['messenger_userinfo'],"broadcasts", "uid={$_USER['uid']}") == '1') {
$sql = DB_query("SELECT count(*) as count FROM {$_TABLES['messenger_dist']} dist LEFT JOIN {$_TABLES['messenger_msg']} msg ON dist.msg_id=msg.id WHERE (target_uid = {$_USER['uid']} AND read_date is NULL) ");
} else {
$sql = DB_query("SELECT count(*) as count FROM {$_TABLES['messenger_dist']} dist LEFT JOIN {$_TABLES['messenger_msg']} msg ON dist.msg_id=msg.id WHERE (target_uid = {$_USER['uid']} AND read_date is NULL) OR (target_uid = '0' AND archive='0')");
}
list($count) = DB_fetchArray($sql);
if ($count > 0) {
$retval = '<a href="' . $_CONF['site_url'] . '/messenger/index.php">' . $LANG_MSG00['usermenu'] . ' (' .$count. ')</a>';
}
}
return $retval;
}
Now create a new block called Message and in Block Function box put "phpblock_newmessages" (without the quotes)
I think that's everything.
GeekLog Hosting, Installations and Upgrades - WWW.AWEHOST.COM - Hosting starts @ only $4.95/mo.