Log in

View Full Version : New PM Notification Outside of vBulletin


kerplunknet
03-16-2006, 08:04 PM
Is there anyway to make an image appear ("NEW PM") when a user has one or more new private messages? This would be outside of vBulletin...

Thanks :)

This code is apparently for vBulletin 2... does anyone know how I could modify it to work with vBulletin 3.0?


<?php

error_reporting(7);

require("global.html");

//check usergroup of user to see if they can use PMs
//$permissions=getpermissions($forumid);
if ($enablepms==1 and $permissions['canusepm'] and $bbuserinfo['receivepm']) {
$ignoreusers="";
if (trim($bbuserinfo['ignorelist'])!="") {
$ignoreusers='AND fromuserid<>'.implode(' AND fromuserid<>',explode(' ', trim($bbuserinfo['ignorelist'])));
}

$allpm=$DB_site->query_first("SELECT COUNT(*) AS messages FROM privatemessage WHERE userid=$bbuserinfo[userid] $ignoreusers");
$newpm=$DB_site->query_first("SELECT COUNT(*) AS messages FROM privatemessage WHERE userid=$bbuserinfo[userid] AND dateline>$bbuserinfo[lastvisit] AND folderid=0 $ignoreusers");
$unreadpm=$DB_site->query_first("SELECT COUNT(*) AS messages FROM privatemessage WHERE userid=$bbuserinfo[userid] AND messageread=0 AND folderid=0 $ignoreusers");

if ($newpm['messages']==0) {
echo "";
} else {
echo "";
}

} else {
$pminfo='';
}

//BEGIN HTML OUTPUT
//BE SURE TO LEAVE THE ECHO Strings in place
//Any Quotation marks need to have a \ before them

if ($bbuserinfo['userid']!=0) {
$username=$bbuserinfo['username'];
echo "Welcome: <b>$username</b> - <a href=\"http://www.ispreview.co.uk/talk/private.php?s=\" target=\"_parent\">New Messages</a>: <b>$newpm[messages] ($allpm[messages] Total)</b>";
} else {
echo "Welcome: <i>You must enable cookies + <a href=\"talk/register.php?s=$session[sessionhash]\" target=\"_parent\">REGISTER</a> to view stats</i>";
}

?>