Thursday, March 22, 2012

Opinions on messaging system..

Hi,

I want a messaging system (so users can message one another) on my site.

To do this, I was thinking to use formview etc and create a table called messages. Then to send a message, the user enters the message into the table with the username of the reciever. Then, the reciever has a messages page with a table view of all messages inserted with username.

Do you think this is a good way of doing it? Or is there a much better way?

Thanks,

Jon

it will work, just note that the user needs to refresh their screen to see any new messages...in otherwords it's not real-time. If that's ok, then it should be fine, otherwise I'd look as some of the 3rd party ones out there...


Hi thanks for your reply.

I'd like to make it so that every time a user name is displayed to people who are logged in they can send that person a message.

I guess that to do that I'd make every user name a link to the send message formview controll (according to role group too), which autofills in the 'reciever ID' column? Can you universally make it so username displayed to logged in users are hyperlinks? and how do you make it so the name they click on autofills into the table column?

Thanks again!

Jon


jbear123:

To do this, I was thinking to use formview etc and create a tablecalled messages. Then to send a message, the user enters the messageinto the table with the username of the reciever. Then, the recieverhas a messages page with a table view of all messages inserted withusername.

That sounds right. It's really not as hard to make as some would think. I worked on the messaging system for a social networking type website, and here's how we did it. (We used PHP and MySQL though.)

CREATE TABLE `Message` (
`MessageID`int(10) unsignedNOT NULL auto_increment,
`PreviousMessageID`int(10) unsignedNOT NULL COMMENT'Points to the Preceding Message in the c onversation',
`SenderID`int(10) unsignedNOT NULL,
`Subject`varchar(64) characterset latin1 collate latin1_general_ciNOT NULL,
`Message`text characterset latin1 collate latin1_general_ciNOT NULL,
`DateSent`int(10) unsignedNOT NULL,
`SenderStatus`int(10) unsignedNOT NULL,
`SenderIP`varchar(32) characterset latin1 collate latin1_general_ciNOT NULL,
PRIMARY KEY (`MessageID`),
KEY `PreviousMessageID` (`PreviousMessageID`)
) ENGINE=MyISAM AUTO_INCREMENT=18004DEFAULT CHARSET=utf8;

The second table was used so members could send message to more than one user.

CREATE TABLE `Message_Recipient` (
`MessageID`int(10) unsignedNOT NULL,
`RecipientID`int(10) unsignedNOT NULL,
`DateRead`int(10) unsignedNOT NULL,
`RecipientStatus`tinyint(3) unsignedNOT NULL,
PRIMARY KEY (`MessageID`,`RecipientID`),
KEY `IX_RecipientID` (`RecipientID`)
) ENGINE=MyISAMDEFAULT CHARSET=utf8;

jbear123:

I guess that to do that I'd make every user name a link to the send message

Not necessarily. Just create a control that contains their user name, and if someone is logged in make a button visible on the control that takes them to the "compose" page. Keep it simple.


Hey man thanks for your reply..

I am confused over the second past of your post - what do you mean a control that contains their user name? Just any control? and when it takes them to the compose page, how do you get the username you clicked into the recipient column?

Thanks,

Jon

0 comments:

Post a Comment