Jump to content

Private Message System For Forum


Katten

Recommended Posts

What is the best practice for creating a private message system for... say a forum? I was thinking you just create a Message table, insert all messages into there and other info such as user id, when someone goes to view messages they can only view them based on their corresponding id. But maybe this one table approach isn't the way to go, just looking for suggestions or advice.

 

 

-thanks!

Link to comment
Share on other sites

The solution will be based upon the features you want to support in this messaging system. If all you need is a "basic" system with sender/receiver ids, text of the message, date sent, and possibly a flag to determine if it has been viewed/read, then a single table is perfectly apprpriate and probably the best approach.

Edited by Psycho
Link to comment
Share on other sites

Well in my application the private message database table stores the following info:

 

mid: Message ID

sender: The sender's info

recipient: The recipient's info

title: Message Title

text: Message Context

datesent: The date message is sent

status: Unread or Read(users are notified by unread messages from a widget at sidebar)

folder: The folder a private message is stored in. Can be Inbox, Outbox, Draft or user created folders

 

So yeah, it really depends on how complex your PM system is gonna be. You can start off with a simple design, but make sure it is extensible and reusable so you can add new features every now and then. If you have other types of messages such as Visitor Message(profile comment), Shoutbox Message and System Message, it will be a good idea to use strategy design pattern.

Edited by Hall of Famer
Link to comment
Share on other sites

Alright thanks for the advice! Psycho you were saying that would be for simple or basic systems but out of curiosity what would you do for more complex pm systems?

 

The answer is "It depends". It cannot be answered without knowing what data would need to be stored for that complext system. I think you are missing the point of how to detemine the database structure. The data to be stored and the logical association of that data should determine what the structure is. So, you can't just say something like "I want to build a shopping cart" and ask for someone to give you the appropriate database design. Sure there might be some basic elements, but YOU need to determine the requiremetns which would then determine the structure needed.

Link to comment
Share on other sites

Ah yes, I wasn't asking to design one for me I was just curious as to how it works, for the sake of knowledge.

 

I wasn't suggesting you were asking for someone to build it for you. Only that the person building such a system would have to analyze the requirements before determining the database structure. If you want to "know how it works" then I suggest finding some resources regarding database normalization.

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.