View Full Version : read messages
Boofo
05-08-2002, 10:25 PM
Can anyone help me with this line of code? I am trying to find the amount of read messages form the listing of messages in the private messages.
$readpm=$DB_site->query_first("SELECT COUNT(*) AS messages FROM privatemessage WHERE userid=$bbuserinfo[userid] AND folderid=0 $ignoreusers");
It is counting all of the messages as read. Any help will be greatly appreciated. Thanks in advance.
Sparkz
05-08-2002, 10:50 PM
You have to add AND readtime!=0
Boofo
05-08-2002, 11:06 PM
Thank you very much. It worked great! But now it says that I still have a new message after reading it. This is the code for new messages. Am I missing something in here also?
$newpm=$DB_site->query_first("SELECT COUNT(*) AS messages FROM privatemessage WHERE userid=$bbuserinfo[userid] AND dateline>$bbuserinfo[lastvisit] AND folderid=0 $ignoreusers");
Admin
05-09-2002, 04:50 AM
Replace dateline>$bbuserinfo[lastvisit] with readtime <> 0 . :)
Boofo
05-09-2002, 05:23 AM
After changing that line of code as instructed, it still says I have one new message when I have already read it. Here is the complete code in case something else is messing it up.
$ignoreusers="";
if (trim($bbuserinfo['ignorelist'])!="") {
$ignoreusers='AND fromuserid<>'.implode(' AND fromuserid<>',explode(' ',$bbuserinfo[ignorelist]));
}
$newpm=$DB_site->query_first("SELECT COUNT(*) AS messages FROM privatemessage WHERE userid=$bbuserinfo[userid] AND readtime <> 0 AND folderid=0 $ignoreusers");
$readpm=$DB_site->query_first("SELECT COUNT(*) AS messages FROM privatemessage WHERE userid=$bbuserinfo[userid] AND readtime!=0 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");
$sentpm=$DB_site->query_first("SELECT COUNT(*) AS messages FROM privatemessage WHERE userid=$bbuserinfo[userid] AND folderid=-1 $ignoreusers");
$allpm=$DB_site->query_first("SELECT COUNT(*) AS messages FROM privatemessage WHERE userid=$bbuserinfo[userid] $ignoreusers");
Hope this is helpful to you because it has me stumped. :-)
yea.. it'll say u have a new message.. but it wont say u have an unread message
Boofo
05-10-2002, 01:47 AM
Ok, I've narrowed it down to cookies. If I turn off "Automatic login with cookies" then it reads it right. But when I go into my usercp with that set, I have to re-login each time. Is there any way to re-set the new messages without cookies interfering with it in any way?
vBulletin® v3.8.12 by vBS, Copyright ©2000-2025, vBulletin Solutions Inc.