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.

V9 PM Table Structrure Explained

This thread is to clarify the mechanics and the table structure for the version 9 core difference than other existing versions.

Column Name Description
message_id ID unique
message_to Receipient User ID
message_from Sender User ID
message_user Owner user ID
message_subject Heading of message
message_message Content of message
message_smileys Use smileys in message, 'y' or 'n', default 'y' indicates yes
message_read Read status, 1 or 0 - 0 indicates new
message_datestamp timestamp
message_folder designated sections inbox - 1 inbox , 2 outbox, 3 archive

Typical situation and data row entry value examples - User 1 sends a message to User 201:

First, entry is the message sent to user 201 with the following values.

message_id = auto increment
message_to = 201
message_from = 1
message_user = 201
message_subject = "Test"
message_message = "Test"
message_smileys = "y"
message_read = 0
message_datestamp = time()
message_folder = 0

AND a copy of your sent message will be made available for user 1

message_id = auto increment
message_to = 201
message_from = 1
message_user = 201
message_subject = "Test"
message_message = "Test"
message_smileys = "y"
message_read = 0
message_datestamp = time()
message_folder = 1

- message_user is 201, indicating this message only can be viewed, deleted, and archived by user 201.
- message_folder must be 0 if current message_user is a recipient. 1 if current message_user is a sender.
- There was no swapping of the `message_to` and `message_from` values in any case. `message_to` always means that original message was sent to whom. Vice versa for `message_from`.
- Only difference here is that we keep a copy for ourselves when sending a message. This is because message_user is the owner of the message entry. Nobody will have access to them. If you delete your message, the other party will still be able to view the original message since he has a copy of it as well.

The SQL callback for all received PM will be:
CodeDownload  
$my_inbox = dbquery("SELECT message_id FROM ".DB_MESSAGES." WHERE message_to=:my_id AND message_folder=0");



The SQL callback for all sent PM will be:
CodeDownload  
$my_inbox = dbquery("SELECT message_id FROM ".DB_MESSAGES." WHERE message_to=:my_id AND message_folder=1");



Notice that in both occassion, the condition column is "message_to" and "message_folder"

The SQL callback for all received and sent PM will be:
CodeDownload  
$my_inbox_outbox = dbquery("SELECT message_id FROM ".DB_MESSAGES." WHERE message_user=:my_id");


or
CodeDownload  
$my_inbox_outbox = dbquery("SELECT message_id FROM ".DB_MESSAGES." WHERE (message_to=:my_id AND message_folder=0) OR (message_to=:my_id1 AND message_folder=1)");

Thread Information
Author
Replies
1 post
Views
232 times
Last Post
Last updated on 2 months 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: Chan