Oh no! Where's the JavaScript?
Your Web browser does not have JavaScript enabled or does not support JavaScript. Please enable JavaScript on your Web browser to properly view this Web site, or upgrade to a Web browser that does support JavaScript.
Sign In
Not a member yet? Click here to register.

Bug in /messages.php


Print Track
Was trying to add a mod when found a bug in the original code.
Around line 415 there is an if statement without snakehooks. Added them, see below.
CodeDownload  
"outbox")) {
 $result = dbquery("SELECT m.message_id, m.message_subject, m.message_message, m.message_smileys,
      m.message_datestamp, m.message_folder, u.user_id, u.user_name, u.user_status
      FROM ".DB_MESSAGES." m
      LEFT JOIN ".DB_USERS." u ON m.message_from=u.user_id
      WHERE message_to='".$userdata['user_id']."' AND message_id='".$_GET['msg_read']."'");
 if (dbrows($result)) {
 $data = dbarray($result);
 $result = dbquery("UPDATE ".DB_MESSAGES." SET message_read='1' WHERE message_id='".$data['message_id']."'");
 $message_message = $data['message_message'];
 if ($data['message_smileys'] == "y") { $message_message = parsesmileys($message_message); } // mod Wanabo, added missing snakehooks.
 add_to_title($locale['global_201'].$locale['431']);
 opentable($locale['431']);



Was trying to make it so that in a users pm outbox the messages are displayed bold, that the receiver did not read yet. Very important request from 1 of my users, who uses the pm system a lot and wants to know if a message is read or not.
I FAILED. Who can help?

3 replies

The problem is the message for the receiver is an other record in the database than the message from the sender.

On composing the message you need to put info in the message for the receiver, about the record id for the corresponding record of the sender. On reading the message, set a flag in the record for the sender the message is read. You know the record ID becouse its put in on composing.
Wanabo has replied to this - 15 days ago

douwe_yntema wrote:

@douwe_yntema - The problem is the message for the receiver is an other record in the database than the message from the sender.
I know, so I need to get message_id='".$_GET['msg_read']."' minus 1, there is the message_read value I need. But I can't code it.

Quote

On composing the message you need to put info in the message for the receiver, about the record id for the corresponding record of the sender. On reading the message, set a flag in the record for the sender the message is read. You know the record ID becouse its put in on composing.
As above, this is set in message_id='".$_GET['msg_read']."' minus 1 It needs some mysql joining, but I have a limit understanding of it.
sender_id $_GET['msg_read'] - 1

Use this value in the query.

To set the read flag, use where message_id = sender_id.

You cannot update a record with a join
author Wanabo
forumSuspected Bugs and Errors - 8
replies4 posts
viewed98 times
activeLast updated on 15 days ago
You can view all discussion threads in this forum.
You cannot set up a bounty in this discussion thread.
You can start a new discussion thread in this forum.
You cannot reply in this discussion thread.
You cannot start on a poll in this forum.
You cannot upload attachments in this forum.
You can download attachments in this forum.
You cannot up or down-vote on the post in this discussion thread.
Users who participated in discussion: Wanabo, douwe_yntema