vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   Member Archives (https://vborg.vbsupport.ru/forumdisplay.php?f=202)
-   -   read messages (https://vborg.vbsupport.ru/showthread.php?t=38437)

Boofo 05-08-2002 10:25 PM

read messages
 
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 [minicode]dateline>$bbuserinfo[lastvisit][/minicode] with [minicode]readtime <> 0[/minicode] . :)

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. :-)

E 05-09-2002 12:57 PM

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?


All times are GMT. The time now is 07:04 AM.

Powered by vBulletin® Version 3.8.12 by vBS
Copyright ©2000 - 2025, vBulletin Solutions Inc.

X vBulletin 3.8.12 by vBS Debug Information
  • Page Generation 0.02631 seconds
  • Memory Usage 1,715KB
  • Queries Executed 10 (?)
More Information
Template Usage:
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)post_thanks_navbar_search
  • (1)printthread
  • (7)printthreadbit
  • (1)spacer_close
  • (1)spacer_open 

Phrase Groups Available:
  • global
  • postbit
  • showthread
Included Files:
  • ./printthread.php
  • ./global.php
  • ./includes/init.php
  • ./includes/class_core.php
  • ./includes/config.php
  • ./includes/functions.php
  • ./includes/class_hook.php
  • ./includes/modsystem_functions.php
  • ./includes/class_bbcode_alt.php
  • ./includes/class_bbcode.php
  • ./includes/functions_bigthree.php 

Hooks Called:
  • init_startup
  • init_startup_session_setup_start
  • init_startup_session_setup_complete
  • cache_permissions
  • fetch_threadinfo_query
  • fetch_threadinfo
  • fetch_foruminfo
  • style_fetch
  • cache_templates
  • global_start
  • parse_templates
  • global_setup_complete
  • printthread_start
  • bbcode_fetch_tags
  • bbcode_create
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • printthread_post
  • printthread_complete