Drupal 7 PrivateMsg Module

By shane
Thu, 2013-01-17 23:34
Daily Dose of Drupal Episode #89

Share with Others

The Drupal 7 PrivateMsg module allows users on your Drupal website to send and receive private messages to one another. The PrivateMsg module is very configurable and can be used on a wide variety of Drupal 7 websites such as community sites and social networking sites.

In this episode you will learn:

  • How to set permissions and configure the Drupal PrivateMsg module
  • How to send a private message to another Drupal user

Hello everyone and welcome to another Daily Dose of Drupal, today we’re on Episode Number 89. As always I’m Shane Thomas, you can follow me on Twitter at smthomas3, you can also come over to codekarate.com sign up for the newsletter here on the left side.

Today we’re going over the Private Message Module. This is a module I’ve used on quite a few sites in the past, Drupal 6 and Drupal 7 and it basically allows you to configure your websites so users can send and receive messages within the website.

This can be useful on many different types of community based sites or social networks, things of that nature and it’s a very useful and very well developed module with a whole bunch of different sub-modules and so I’ll to get a few of them now and maybe I’ll do another episode later with going into more detail on the other sub-modules that come along with the Private Message module.

So I have a test site here and it’s pretty much a basic Drupal 7 site and I’ll come in here and look and see that I have a private message module downloaded, you can see it comes with looks like about 8 different sub-modules. I’m to first just turn on the basic Private Messages Module and we’ll start there.

You can see it does have e-mail notifications, the ability to block user messages, the ability to filter messages using tags, you can set private message limits using this module, there’s a real name integration which the real name module would basically allow you to specify a user’s real name and then of course integrates with that so you can message someone using their real name versus their user name on Drupal, you can send messages to members of a role and you can also integrate this with rules which I have some past videos on Rules and this can of course be handy if you’re using Rules for some of your different workflows on your Drupal website.

We’re just going to start with just a Private Messages Module so I went ahead and turn that on and I’m going to go ahead and first come in to Permissions and down here there will be some permissions for private messages. So I’m going to allow authenticated users to read the private messages, to write new private messages, to delete their own and reply to private messages, we won’t let them use tokens or select the text formats so we’ll go ahead and use that for permissions so basically allowing authenticated users to send and receive private messages back and forth.

Now I will come back into … and click on the Configuration so we can do a little bit of configuration here and the good thing about the Drupal 7 version of the Private Messages Module is it’ll integrates with Drupal Fields so you can configure things pretty easily here.

So here it says threads per page, you can configure page to show participants, different options there, select a number of messages, you can also go through different displays. So what we’re going to do is we’re actually going to look at the Manage Fields section and you can see that this just uses just the regular old Drupal Fields API so you can add as many fields as you want, it comes with a two which is recipient field, subject, the body so you can add multiple fields there.

I’m not going to actually do any of that because when it comes with this … pretty much covers most used cases or at least my used case in this simple example. You can also of course manage the display if you add extra fields but we’re going to go ahead and actually start by adding or creating a message here. So already went to the settings, we already went through the permissions.

Now we actually are going to create a private message … oops that’s not what I want to click. And I’m going to add this private message links to the first side bar just so I actually can see the links, you can of course add your own links once you know the path so you can use this … the links that are provided in this block so I’ll go ahead and I’ll close this. You can see now I have write new messages, I can also view my messages, I go here it says I have no messages available, I’ll go ahead and write a new message, I do have the user called “Test” and that’s the user name, you can enter multiple recipients so I’m going to go ahead and send the message there and once I send it you can see it says that it was sent by me and it says it’s a test message between you and test and come to my messages and see that it has been sent out, you can mark it as a read or unread, I can check this and delete it.

What I will go ahead and do is I’ll hop over here and log in as this test user, it says I have one unread message here in this messages section on the Drupal site, you can also see it says I have one new message, I can see that it says that it’s new, click on it and I can reply.

Once I send that it says that the Shane User which is the original user sent this message and I sent this message. Of course that works both ways if I come back it says I have a new message and you can of course send messages to all different types of users depending on their permissions of course. If I come to the user’s profile page I got here of course by clicking on the user name here but if you’d had profiles like a social network you can of course put a link here to send this user private message and it will default that user in the two fields.

So that’s really it for the basics of Private Messages, this can get you started for allowing users to communicate back and forth on your website in a private manner so that only they can see the messages so it’s good for private conversations on a website.
Go ahead and give this module a try and next time we’ll go through some of the other modules that come with private messages module and we’ll see what other features we can add for this. Thanks for watching the Daily Dose of Drupal and we’ll see you next time.


Hello Shane,
What modules did you use to turn on the modules when doing privatemsg video

I used the development version of the Module Filter module. I use it on almost every Drupal website I build as it makes turning on/off modules much easier.

I happened upon your Drupal 7 PrivateMsg module episode. Such a time saver. Well done. Thank you!

Post new comment