Register Members List Search Today's Posts Mark Forums Read

Reply
 
Thread Tools
  #1  
Old 02 May 2004, 15:58
mark99 mark99 is offline
 
Join Date: Oct 2002
External PHP Private Message Stats

I use a very simple piece of PHP code to show the visitors username, unread PM's and total PM's when they first visit the site. Code (what I used under vBulletin 2):

<?php

error_reporting(7);

require("global.php");

//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>";
}

?>
Now obvious these tables have changed in vB3, in fact there are now several tables (pm, pmtext etc.) witt the data I need to access in. I'm not good at PHP, so could somebody please show me the changes required to once again be able to show the PM stats?
Reply With Quote
  #2  
Old 02 May 2004, 16:36
mark99 mark99 is offline
 
Join Date: Oct 2002
Never mind, I found the updated hack for vB3 and cut it down again, works ok now .
Reply With Quote
Reply

Similar Threads
Thread Thread Starter Forum Replies Last Post
Mini Mods GS - Visitor Message Private Message Notification 1.0 ForumsMods vBulletin 3.7 Add-ons 10 27 Oct 2011 11:56



Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off


New To Site? Need Help?

All times are GMT. The time now is 05:16.

Layout Options | Width: Wide Color: