PDA

View Full Version : Showing PM info on Non-VB page - How??


10-30-2000, 05:36 AM
Hello everyone,

I want to be able to show a users Private Messaging status, like on the forum homepage, on a non-vbulletin type page.

Any ideas?

10-30-2000, 08:44 AM
This is what i used, i got it in an include on my index page, hope it works for you too.


<?
//PM HACK
if ($bbusername) {
$username = $bbusername;
$pmcounta = $DB_site->query_first("SELECT COUNT(msgid) AS msgid FROM privatercvd WHERE toid=$bbuserid");
$pmcount = $pmcounta[msgid];
$newpmcounta = $DB_site->query_first("SELECT COUNT(msgid) AS msgid FROM privatercvd WHERE toid=$bbuserid AND UNIX_TIMESTAMP(datetime)>$bblastvisit");
$newpmcount = $newpmcounta[msgid];
if ($newpmcount == 0) {
$lightbulb = 'images/off.gif';
} else {
$lightbulb = 'images/on.gif';
}

if ($lastsent = $DB_site->query_first("SELECT msgid,fromid,UNIX_TIMESTAMP(datetime) AS datetime FROM privatercvd WHERE toid=$bbuserid ORDER BY msgid DESC")) {
$lastid = trim($lastsent[fromid]);
$lastdate=date($dateformat,$lastsent[datetime]+(($timeoffset+$bbtimezoneoffset)*3600));
$lasttime=date($timeformat,$lastsent[datetime]+(($timeoffset+$bbtimezoneoffset)*3600));
$lastsentuser = $DB_site->query_first("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("<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>");
} else {
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>");
}

//END PM HACK

?>


demo:
http://www.pcmarket.com.au

10-30-2000, 08:49 AM
oops
i forgot to mention that you will probably have to
"require" the global.php from the forum directory to get this working too.

eg.


<?php
require($DOCUMENT_ROOT . "/forum/global.php");
?>


put that on the top of the html page that you are posting this pm info to.