Luke
06-06-2001, 02:36 AM
I need a vbulletin pm hack .. that will enable me to show users on my main page of the website that they have new private messages or not.. I wrote my own code but for some reason it doesnt work.. can someone take a look at it at least.
I searched all over for it but couldnt find it.
Thanks
<?
echo $bbuserid;
//PM HACK
if (isset($bbuserid)==0 or $bbuserid==0 or $bbuserid=="") {
echo("<font size=1 face=verdana,arial><b>Private Messages:</b><br><a href=forum/private.php>Login to read your private messages!</a></font><br><br>");
} else {
require("/www/site/forum/config.php");
$db=mysql_connect($servername,$dbusername,$dbpassw ord) or die("Can't open connection to MySQL");
mysql_select_db($dbname) or die("Can't select database");
$username = $bbuserinfo[username];
$pmcounta = "SELECT COUNT(privatemessageid) AS privatemessageid FROM privatemessage WHERE touserid='$bbuserid'";
$pmcount = $pmcounta[privatemessageid];
$newpmcounta = 'SELECT COUNT(privatemessageid) AS privatemessageid FROM privatemessage WHERE touserid=$bbuserid AND UNIX_TIMESTAMP(dateline)>$bblastvisit';
$newpmcount = $newpmcounta[privatemessageid];
echo $pmcount.$row["privatemessageid"];
echo $pmcount;
if ($newpmcount == 0) {
$lightbulb = 'http://www.site.com/newmx6/board/images/off.gif';
} else {
$lightbulb = 'http://www.site.com/newmx6/board/images/on.gif';
}
if ($lastsent = 'SELECT privatemessageid,fromuserid,UNIX_TIMESTAMP(datetim e) AS dateline FROM privatemessage WHERE touserid=$bbuserid ORDER BY privatemessageid DESC') {
$lastid = trim($lastsent[fromuserid]);
$lastdate=date($dateformat,$lastsent[dateline]+(($timeoffset+$bbtimezoneoffset)*3600));
$lasttime=date($timeformat,$lastsent[dateline]+(($timeoffset+$bbtimezoneoffset)*3600));
$lastsentuser = 'SELECT username FROM user WHERE userid=$lastid';
$lastuser = htmlspecialchars($lastsentuser[username]);
$lastuserlink = "<a href=\"forum/private.php?action=show&msgid=$lastsent[msgid]&password=$bbpassword\">$lastuser</a>";
} else {
$lastuserlink = "<i>No one</i>";
}
echo mysql_error();
echo("<font size=1 face=verdana,arial><b>Private Messages:</b><br><a href=forum/private.php>Read them!</a><BR>You have $pmcount private message(s) ($newpmcount new) - Latest Message from $lastuserlink</font>");
}
//END PM HACK
?>
I searched all over for it but couldnt find it.
Thanks
<?
echo $bbuserid;
//PM HACK
if (isset($bbuserid)==0 or $bbuserid==0 or $bbuserid=="") {
echo("<font size=1 face=verdana,arial><b>Private Messages:</b><br><a href=forum/private.php>Login to read your private messages!</a></font><br><br>");
} else {
require("/www/site/forum/config.php");
$db=mysql_connect($servername,$dbusername,$dbpassw ord) or die("Can't open connection to MySQL");
mysql_select_db($dbname) or die("Can't select database");
$username = $bbuserinfo[username];
$pmcounta = "SELECT COUNT(privatemessageid) AS privatemessageid FROM privatemessage WHERE touserid='$bbuserid'";
$pmcount = $pmcounta[privatemessageid];
$newpmcounta = 'SELECT COUNT(privatemessageid) AS privatemessageid FROM privatemessage WHERE touserid=$bbuserid AND UNIX_TIMESTAMP(dateline)>$bblastvisit';
$newpmcount = $newpmcounta[privatemessageid];
echo $pmcount.$row["privatemessageid"];
echo $pmcount;
if ($newpmcount == 0) {
$lightbulb = 'http://www.site.com/newmx6/board/images/off.gif';
} else {
$lightbulb = 'http://www.site.com/newmx6/board/images/on.gif';
}
if ($lastsent = 'SELECT privatemessageid,fromuserid,UNIX_TIMESTAMP(datetim e) AS dateline FROM privatemessage WHERE touserid=$bbuserid ORDER BY privatemessageid DESC') {
$lastid = trim($lastsent[fromuserid]);
$lastdate=date($dateformat,$lastsent[dateline]+(($timeoffset+$bbtimezoneoffset)*3600));
$lasttime=date($timeformat,$lastsent[dateline]+(($timeoffset+$bbtimezoneoffset)*3600));
$lastsentuser = 'SELECT username FROM user WHERE userid=$lastid';
$lastuser = htmlspecialchars($lastsentuser[username]);
$lastuserlink = "<a href=\"forum/private.php?action=show&msgid=$lastsent[msgid]&password=$bbpassword\">$lastuser</a>";
} else {
$lastuserlink = "<i>No one</i>";
}
echo mysql_error();
echo("<font size=1 face=verdana,arial><b>Private Messages:</b><br><a href=forum/private.php>Read them!</a><BR>You have $pmcount private message(s) ($newpmcount new) - Latest Message from $lastuserlink</font>");
}
//END PM HACK
?>