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.
Not a member yet? Click here to register.
Forgot Password?

Bug in /messages.php

Asked Modified Viewed 968 times
W
Wanabo
W
Wanabo 10
www.probemyip.com/probe-my-ip-80x15.png
pHp-Fusion.Asia & pHp-Fusion.Fr & pHp-Fusion.Cn are available for a localized support community. Send PB for info.
  • Senior Member, joined since
  • Contributed 598 posts on the community forums.
  • Started 94 threads in the forums
  • Started this discussions
asked
Senior Member

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.
"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?
0 replies

2 posts

D
douwe_yntema
D
  • Senior Member, joined since
  • Contributed 667 posts on the community forums.
  • Started 57 threads in the forums
  • Answered 1 question
answered
Senior Member

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.
1 reply
D
douwe_yntema
D
  • Senior Member, joined since
  • Contributed 667 posts on the community forums.
  • Started 57 threads in the forums
  • Answered 1 question
answered
Senior Member

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
0 replies

Labels

None yet

Statistics

  • Views 0 views
  • Posts 2 posts
  • Votes 0 votes
  • Topic users 2 members

2 participants

W
W
Wanabo 10
www.probemyip.com/probe-my-ip-80x15.png
pHp-Fusion.Asia & pHp-Fusion.Fr & pHp-Fusion.Cn are available for a localized support community. Send PB for info.
  • Senior Member, joined since
  • Contributed 598 posts on the community forums.
  • Started 94 threads in the forums
  • Started this discussions
D
D
  • Senior Member, joined since
  • Contributed 667 posts on the community forums.
  • Started 57 threads in the forums
  • Answered 1 question

Notifications

Track thread

You are not receiving notifications from this thread.

Related Questions

Not yet