Welcome Guest, Not a member yet? Register   Sign In
Private Messaging System
#1

[eluser]FlashUK[/eluser]
Hi there,

I've pretty much thrown myself into the deep end and have started working on my first project with an MVC framework.

I have already integrated FreakAuth into application and have made subtle modifications (well, except for changing the structure to accept a birthday field/age restriction).

My Question: Is there an established PM system out there already? I've had a search on the forums and wiki but I didn't find anything. If I have clearly missed it, please point it out to me otherwise I am going to have to spend time writing my own.

I already have an idea of what structure it needs. I'm just wondering how I am going to manage group messages... hmm. Maybe we can start a discussion on this and I will code the module for the community?

Cheers
#2

[eluser]Michael Wales[/eluser]
I don't think there is a pre-existing one, it's not very hard to do.

1. Posting form
2. Basic insertion into the database
3. In your controller check if there are new messages for the user, pass a '0 Messages' or 'X Messages' variable to the view.
#3

[eluser]phpMaster[/eluser]
hi!
I did some research last year.
There are not much around regarding standalone PM Message Systems for PHP.

I have setup 2 different applications working:

1. I separated the PM bit out of the files of an open source Forum software.
I modifed a few things.
(I chose a forum that was simple and where PM scripts were more like a module addon.)
And I got it working. Uses flatfile storage.

2. There is an old Sourceforge.net project PMSys
I installed one CVS version,
and I have it working. Uses MySQL storage.

http://pmsys.sourceforge.net/cvs.php
At this download page, you will find the following:
Quote:.
* PMS-CVS.tar.gz (66.2Kb)
* PMS-CVS.zip (106.7Kb)

* PMSys3-CVS.tar.gz (24.4Kb)
* PMSys3-CVS.zip (57.6Kb)

CVS Snapshot last updated on: Aug 21, 2005 16:46 GMT

You can view the complete source, using the .phps files located here.
For PMSys3 the source can also be found there

I have tried installing both of these two:
* PMS-CVS.zip (106.7Kb)
* PMSys3-CVS.zip (57.6Kb)

PMSys3-CVS.zip (57.6Kb) does not work, at least not for me.
So, I recommend you try this, which I use:
* PMS-CVS.zip (106.7Kb) .. this is actually: PMSys version 2.3.1 ( january 2004 )


Latest stable PMSys 2.3.0 .. is from december 2003
Project Homepage: http://pmsys.sourceforge.net/index.php

I attach a screenshot of my PMSys page

Regards - phpMaster
#4

[eluser]FlashUK[/eluser]
Hi,

Thanks for your posts. It is probably going to be simpler to build my own by the looks of things.

Thanks for the links phpMaster but the code looks outdated. Even though it maybe usable I wish it to be written in CI guidelines to improve performance.

I guess there's nothing left to do but put fingers to keyboard -__- thanks again for your replies.
#5

[eluser]Michael Wales[/eluser]
Yeah, something like a Private Messaging system is hard to develop without a specific application in mind. Jus the user management aspects of the feature (make sure the user is logged in, a user can only view their own messages, a user can only send a message to another registered user, etc). It's all very proprietary and could be developed a thousand different ways depending on your user management backend.
#6

[eluser]phpMaster[/eluser]
Yes,
it is old code, but working.

Now, it can be good to have a look at the DataTables used in PMSys.
You know when 'CREATE table ....'
And also have a look at the menu = The Functions.
See what features you would want to have, and what you do not need.
By looking at my attached screenshot,
you can see what features there is that you may want.
One 'extra' function is EXport = export messages to a file.

--------------------------------------------------

Here are the 3 SQL tables used:
- log
- messages
- users
Messages & Users are minimum.
The 'log'-table I am not sure how is used.
Maybe each time someone logs in/ visit???

'emailnot' ???
'nots' ... ???
'showemail' is obvious
'inmemlist' is if you want to be visable in Memberslist
Code:
$sql = "CREATE TABLE `".$_POST['log_table']."` (
  `ip` varchar(50) NOT NULL default '',
  `hostname` varchar(50) NOT NULL default '',
  `country` varchar(50) NOT NULL default '',
  `http_referer` varchar(225) NOT NULL default '',
  `user_agent` varchar(225) NOT NULL default '',
  `timestamp` datetime NOT NULL default '0000-00-00 00:00:00',
  PRIMARY KEY  (`ip`),
  UNIQUE KEY `ip` (`ip`)
) TYPE=MyISAM;";
$Result01 = $database->query($sql);

$sql = "CREATE TABLE `".$_POST['messages_table']."` (
  `id` int(10) unsigned NOT NULL auto_increment,
  `date` int(10) default NULL,
  `recipient` text,
  `sender` text,
  `subject` text,
  `body` text,
  `unread` text,
  `folder` text NOT NULL,
  `mailed` text NOT NULL,
  PRIMARY KEY  (`id`)
) TYPE=MyISAM;";
$Result03 = $database->query($sql);

$sql = "CREATE TABLE `".$_POST['users_table']."` (
  `id` int(10) unsigned NOT NULL auto_increment,
  `user` text,
  `pass` text,
  `email` text,
  `name` text,
  `timeoffset` text NOT NULL,
  `count` int(10) NOT NULL default '0',
  `emailnot` text NOT NULL,
  `nots` text NOT NULL,
  `inmemlist` text NOT NULL,
  `showmail` text NOT NULL,
  `timestamp` int(10) NOT NULL default '0',
  PRIMARY KEY  (`id`)
) TYPE=MyISAM;";
#7

[eluser]Michael Wales[/eluser]
You already have FreakAuth tied into your app so your going to have to base it off of that user table anyways. Looking over the post table above can lend yourself to some ideas, I'd make a few changes to it though.

1. Make the unread column an ENUM('Y', 'N') - maybe even change the column name to read, just to prevent any confusion (almost seems like a double-negative).

2. Ditch the folder column unless you plan on adding that functionality - in my experience, they are rarely used in little messaging systems like this.

3. Ditch the mailed column, not sure what it would be used for. Probably a cron job would run through and send an email to users telling them they have a PM. If you intend to implement that, make the mailed column an ENUM('Y', 'N').

4. I've never used FreakAuth, but I can't imagine it lacks an id column for the users. If so, change sender and recipient to SMALLINT UNSIGNED fields and use the user's ID instead.

5. I'd change the subject to a VARCHAR(255) as well, that should be plenty for a subject line, hell 100 characters should be enough.

6. I completely agree with the date field being a Unix timestamp, although I like to use VARCHAR rather than INT for my date fields (not sure why I do that... just something I saw somewhere and picked up on). I'm not sure if there's really a benefit in using either one, except you can perform mathematical operations on the database with the INT field (math ops in PHP will perform fine, no matter the field type).




Theme © iAndrew 2016 - Forum software by © MyBB