Skip to main content

This site requires you to update your browser. Your browsing experience maybe affected by not having the most up to date version.

We've moved the forum!

Please use forum.silverstripe.org for any new questions (announcement).
The forum archive will stick around, but will be read only.

You can also use our Slack channel or StackOverflow to ask for help.
Check out our community overview for more options to contribute.

All other Modules /

Discuss all other Modules here.

Moderators: martimiz, Sean, Ed, biapar, Willr, Ingo, swaiba

Private Messaging Module


Go to End


34 Posts   8033 Views

Avatar
lenix

Community Member, 3 Posts

19 December 2008 at 5:08pm

Hi,

i would like to rework the privatemessaging module a little so i could use it to replace phpBB2's pm functions. these are the things i would like to change/add:

1.) sort messages into 3 folders -- "Inbox", "Sent", "Archive". these can be virtual and wouldn't need an extra table, just another column to seperate "Inbox" from "Archive".

2.) support bbcode in messages, should be trivial since you could just copy&paste from the blog-module.

3.) seperate the "PrivateMessage" table into 2 tables, one for "from", "to" and "status" (read/unread) informations and another one for the message itself (date, subject, body). this way the sender can keep a message in his "Sent" folder while the recipient can delete the message already or the other way around. only if all references in the "from and to" table to a message are deleted the message itself will be deleted, too.

4.) enable multiple recipients per message. after 3.) is done this should be easy, too.

5.) make the list of available recipients "Nickname"-based since the forum uses this attribute to represent a member all over the place.

About 5: i'm going to use privatemessaging as a forum-feature mainly, but there might be sites which want to use PM without having the forum installed. there's another problem when using forum and PM together: members might choose to keep there First- and Surname private, but PM would still reveal them in the "Sent to" dialog. I'm not sure how to solve this, maybe an option in the backend which allows to configure the format of an item in the recipients list?

please let me know what you think about all this :-)

// lenix

Avatar
Breastfed

Community Member, 44 Posts

9 March 2009 at 7:31am

Any News about this Module?

I am very interessted in that one.

Thanks

Avatar
Breastfed

Community Member, 44 Posts

8 April 2009 at 11:33pm

any News?

Avatar
jonm80

Community Member, 12 Posts

15 January 2010 at 3:56am

i have customised this module here are the files (i intend to do more still working on it)

whats been changed?
added inbox,readbox and sentbox folders
added another template contains divs for folder links like Inbox(n of messages) - inbox(5)

removed the member select box when sending messages -> just type the nickname in, you can also type multiple nicknames seperated by a comma jon,bob,eddy etc
(the only thing with this is it will give you multiple sent items for the 1 message at the moment)

also modified my page.php file and page.ss to give a notification heres the code for that

Page.php

	function getpm3(){
		$me = Member::currentUser();
			if($me){	
				$pm = DataObject::get("PrivateMessage", "", "Created DESC ", "WHERE ToID = $me->ID AND red=0");
					if($pm){
							$this->unread2 = 0;
							foreach ($pm as $k=>$v){
								if($v->red == 0){
									$this->unread2 = $this->unread2 +1;
								}
																}
							return $this;
						}
					else{
						return null;
					}
			}

	}

and Page.ss

<% include PMNotify %>

you'll also need to make a PMNotify.ss page in your themes Include dir

<% control getpm3 %>
<% if getpm3 %>
<div class="pmnotify">
<p><a href="private-messages/">you have $unread2 unread messages. click here to read</a></p>
</div>
<% else %>
<div class="pmnotify">
<p>no messages</p>
</div>
<% end_if %>
<% end_control %>

please note that im new to silverstripe, so there might be a few glitches here, im activley working on this so will update it soon
there is no styling with this other than what was done by the original author

ofcourse full credit to the original author, comments and suggestions welcome

Attached Files
Avatar
jonm80

Community Member, 12 Posts

15 January 2010 at 4:03am

i also use the forum module, i plan on coding some form of integration for that too suck as pm links

Avatar
jonm80

Community Member, 12 Posts

15 January 2010 at 7:12am

made some more changes found bugs! lol

update-
added bounce message if nick is not found
made changes to template files added divs & styling
added redirect back to current folder when deleting messages
accounted for a sender or reciever deleting pm so both parties are not effected
added "sent to"

heres the css you'll need to add the Require line in mysite/code/Page.php

.privatemessaging{
	width:100%;
	position:relative;
}
.pmlinks{
width:100%;
display:inline;
}
.pmlink{
width:20%;
float:left;
padding-top:10px;
padding-bottom:10px;
text-transform:capitalize;
}
.pmmessages{
width:100%;
float:left;
clear:left;
}
.pmtable{
width:100%;
}
.pmtable tr th{
background: #111111 url(../images/eve/navbar.png) repeat-x; 
font-size:1.2em;
font-weight:bold;
text-transform:capitalize;
}
.pmrowodd{
background: #222222;
}
.pmroweven{
background: #333333;
}

thats all for now, will update this thread in a week if theres any bugs will sort these asap

Attached Files
Avatar
Euphemismus

Community Member, 82 Posts

15 January 2010 at 7:22am

Hi,

this is just too funny ;-) Since I'm building a community module for a musician-search platform, I stumbled upon this module yesterday.
The basic code is quite nice and efficient and I've got a lot of ideas... So I started coding last night.
And today I see there are other people interested.
Question is: Do you want to focus on forums-integration or do you intend to build something generic that could be reused for several things.
In general I'm more the generic-things-guy. Why not build this thing with switchable forums-support? E.g. checkbox to enable/disable nickname support, add a switchable e-mail notification for new messages, ...
Anyone interested in cooperation?

Avatar
UncleCheese

Forum Moderator, 4102 Posts

15 January 2010 at 7:55am

I'll be building something like this for a major project over the next few months. I'll be sure to post my code when I'm done.

Go to Top