
if (!$xoopsUser) {
redirect_header(XOOPS_URL."/user.php",3,_Please_Login);
exit();
}
// Rest of code to be run by logged in users goes after here
define("_Please_Login","Please Login to access this page");
//
// ------------------------------------------------------------------------- //
// E-Xoops: Content Management for the Masses //
// < http://www.xoops.com > //
// ------------------------------------------------------------------------- //
// ------------------------------------------------------------------------- //
function Check_PM()
{
global $xoopsDB,$xoopsUser;
if (is_object($xoopsUser)) {
$uid = $xoopsUser->getVar('uid');
$uname = $xoopsUser->getVar('uname');
$sql = "SELECT COUNT(*) FROM $db->prefix('priv_msgs`) WHERE `to_userid` = $uid AND `read_msg` = 0";
$result = $xoopsDB->query($sql);
list($count_PMs) = $xoopsDB->fetchRow($result);
switch ($count_PMs):
case 0:
Return false;
case 1:
$block['message'] = ".XOOPS_URL."/modules/pm/>".$uname." you have ".$count_PMs." unread message.";
break;
default:
$block['message'] = ".XOOPS_URL."/modules/pm/>".$uname." you have ".$count_PMs." unread messages.";
endswitch;
Return $block;
} else {
Return false;
}
}
?>