The Arcive of vBulletin Modifications Site. |
|
read messages Details »»
|
|||||||||||||||||||||||||
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. Show Your Support
|
|||||||||||||||||||||||||
| Comments |
|
#2
|
||||
|
||||
|
You have to add AND readtime!=0
|
|
#3
|
||||
|
||||
|
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"); |
|
#4
|
||||
|
||||
|
Replace [minicode]dateline>$bbuserinfo[lastvisit][/minicode] with [minicode]readtime <> 0[/minicode] .
|
|
#5
|
||||
|
||||
|
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. :-) |
|
#6
|
||||
|
||||
|
yea.. it'll say u have a new message.. but it wont say u have an unread message
|
|
#7
|
||||
|
||||
|
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?
|
![]() |
|
|