smerny Posted August 10, 2009 Share Posted August 10, 2009 I am creating code for personal messages, the way I came up with was to create 2 databases, one called "convsersations" and the other called "messages", I decided to have ID_convo as one of the messages fields in order to group messages together into conversations (such as gmail does with emails) and whenever a reply is sent to a message, that message is given the same ID_convo as the message it was posted in response to. the inbox shows the conversations in order of which has the newest message, showing the number of messages within the convo, and being highlighted if their is unread mail... when you click on a conversation you see all the messages with that ID_convo (the ones you sent as well as the ones sent to you) I was thinking I'd make messages have a field like "status" which would be set to 0 at first, then 1 after the recipient read it, 2 if the recipient deletes it (so the sender could still see it in their sent mail), 3 if the sender deletes it (so the recipient could still see it) and either delete it or give it a 4 after both have deleted it... although I feel this would work good in for two people messaging back and forth... I'm unsure about how to get it to work for multiple people... any suggestions? Link to comment https://forums.phpfreaks.com/topic/169679-personal-messages/ Share on other sites More sharing options...
Shadow Jolteon Posted August 10, 2009 Share Posted August 10, 2009 I do something very similar for my website... What I did was create three separate tables: one for the discussions, one for the messages, and one for the users included in discussions. The users table contains columns for the status (whether the user is still included in the discussion or not) , the user's ID number, one for which discussion the user is in, and one for the last read message the user read (useful for jumping straight to unread messages and which page they are on, if you are paginating the discussions). I hope this helps. =) Link to comment https://forums.phpfreaks.com/topic/169679-personal-messages/#findComment-895142 Share on other sites More sharing options...
smerny Posted August 10, 2009 Author Share Posted August 10, 2009 how do you go about deleted posts or conversations? i guess that would also have to go in the users table, status field also? Link to comment https://forums.phpfreaks.com/topic/169679-personal-messages/#findComment-895160 Share on other sites More sharing options...
Shadow Jolteon Posted August 10, 2009 Share Posted August 10, 2009 For deleting conversations, I have a status field for the conversations themselves. When this value is 1, the conversation is "locked", and inaccessible for anyone included. Though, for that on my site (because of the way my personal messenger system works), only the person who created the PM can do that. I don't have a way to delete specific messages (since I have PMs working a lot like forum threads, so older messages can still be read), but if I did, I would probably use either a fourth table that shows which messages have been deleted by which user, or just delete the messages from the messages table altogether. Though, for my system, the way I mark which posts are read is just putting the message ID into the read part of the users table, and have it jump to the next new message in the PM using an HTML anchor. Link to comment https://forums.phpfreaks.com/topic/169679-personal-messages/#findComment-895191 Share on other sites More sharing options...
smerny Posted August 11, 2009 Author Share Posted August 11, 2009 alright, thanks for input Link to comment https://forums.phpfreaks.com/topic/169679-personal-messages/#findComment-895227 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.