Drupal 7 PrivateMsg Module Part 2 filters, roles, limits, emails

By shane
Fri, 2013-01-18 19:15
Daily Dose of Drupal Episode #90

Share with Others

This episode continues where the last video on the Drupal 7 PrivateMsg module left off and goes into many of the various sub modules that the come included with the Drupal 7 Private Mesages module.

In this episode you will learn:

  • How to send emails to users when they receive a private message
  • How to allow users to block other users from sending private mesages to them
  • How to configure Private Msg blocking rules
  • How to set limits on the amount of private messages a user can send or receive on your Drupal site
  • How to send private messages to all the users in a specific role
  • How to use the Private Msg filter module to narrow down the list of messages a user is viewing
  • How to use PrivateMsg tagging to tag or categorize various private messages

Hello everyone and welcome to another Daily Dose of Drupal, today we’re on Episode Number 90 and yesterday if you watched the previous episode we’re going over the Drupal 7 Private Message Module.

The Drupal 7 Private Message Module that we went over yesterday was just a very basic module. Just the ability to send and receive Private Messages between users on the Drupal site.

Today we’re going to look at the different sub-modules or at least a good number of them that come with a private messages module but before we get started as always I’m Shane Thomas, you can follow me on Twitter at smthomas3 and you can also go to codekarate.com.

It’s just a site right here and sign up for the newsletter right here on the left if you have not already. So let’s go ahead and gets started; I have the Private Message module installed just from yesterday, we’re basically starting right where I left off and I will go ahead and get started.

You can see we have the Private Messages block over here that allows you to easily get to your messages. You can also get to it from this link up here or if you go into my account there’s also messages link so that’s how you can get to your messages but we’re going to look at the different modules that we can turn on. In this Mail fields you can see that there’s a whole bunch of them over here.

So the first that we can turn on is the Private Message e-mail notification and I’m just going to go over these very briefly to show you what they can do and how you can start to configure them. I’m not going to be able to go into all of them in complete detail because there’s quite a bit in this list.

So we’ll go ahead and turn that one on and now if I come back here I’ll click this configure link and you can see there’s a new area over here and I know I didn’t go through all of these different options completely yesterday but they’re pretty self-explanatory for these first four configuration options.

This e-mail notifies now new because I turned on the module for e-mail notifications, you can say if you want to default, notify or not notify new or uses of new private messages you can configure the e-mail that gets sent out. It also allows you to then come into your account settings or you can allow users to come into their account settings, edit the account and in this Private Messages section select whether they want to receive e-mail notifications.

You can also with permissions select whether you want them to be able to turn on of turn off Private Messages. A lot of these are all permissions based so you’ll have to look at the Permissions and just make sure that you have setup correctly for the different roles on your Drupal 7 website. We’re next going to go to this Block User Messages. This is going to allow users to block other users from sending messages.

So once we get this one turned on we can come here and click Configure and you can see this actually adds a tab. I’ve added a rule here that basically says if the author is an administrator and the recipient is an authenticated user then the user cannot block the author and you can add a whole bunch of other different types of rules if you need to but basically you can add rules to make sure that maybe certain roles can’t send two other roles or maybe certain users should not be able to block other users.

So that’s the first step as you can configure out the different rules for different ways to block users and then of course when you come into your messages section there’s now a tab for Block Users and here you can select specific user names, you can then block this user if you want, they will no longer be able to send you message if, it will let them know that they’ve been blocked and then you can of course unblock them so that’s how that works, pretty simple.

Let’s go in and check out the next module; the Private Message Limits Module is another handy one especially if you have a lot of users on your site and you don’t want people to take advantage of the private Messaging features so we’ll come back into the configuration page and there’s a Limits tab up here. Basically this one will allow you to set different limits depending on sending and receiving. So you can limit the number of conversations or number of messages per conversation. You can limit how many or the total messages or conversations that the user can receive; you can limit either the messages or the conversations and of course set the max.

You can also change that for specific roles if you want administrators not to have a limit you can set that there but have authenticators be limited to maybe only 50 different messages. And this is probably the most important one is you can limit the number of messages that a user can send in a specific time period and that’s to prevent users from taking advantage of private messaging and spamming other users on your site so you can limit to say they can only send 5 messages in a given time period whether that’s an hour, a day, 30 minutes depending on the needs of your website then you can of course overwrite that role so you can remove the limit for administrators and then you can also limit how many recipients then can add to the message so they don’t add or try to send a message to every user on the site or an extremely large amount of users and of course it’s all over writable by role. So that’s what the Private Message Limits Module does.

We have a couple more we’re going to go through quick; the Private Message Roles Module is second to last one we’re going to go through and this one is another handy one. It doesn’t necessarily have any configuration but what it does allow you to do is if you come into your messages section on your Drupal site in your account and you go to write in new message you see there’s another area here that says you can enter the name of the role to write a message to all users that have that role.

So I can send to all authenticated users or I can send to all administrators and this is a permission based so in this case you probably only want to allow admins to have this access but depending on your site’s need. You can open up to other users as well and it allows you to send a private message to everyone in that specific role. So it’s definitely handy if you make changes to your site or you need to notice or send notices to all users at once.

We’ll go ahead and check out the last one here and this is the Private Message Filter Module. So this is going to make quite a few changes here to the way that your messages are setup. So if I come back to here I don’t believe that there’s anything else that’s added.

Well I guess there is the tags so I’ll go over this in a second but the rest of it is pretty much the same for configuration options. However when I come back to the messages page you can see now I have extra tabs. I have my Inbox which show nothing because I’ve already read all the messages. It lists my sent messages and also all my messages and then I still have the Block Users tab from before.

This one allows you to do a couple of things; I can filter messages by subject so if I want to search for subject with test of course I get this one still showing up. If I search for something that’s not it will not show up, you can search by participants so I can search just for the test user that I have conversations going with, you can also save this filter. You can then also apply tags.

So I want to apply this test tag to this message, I can apply that and it allows you to undo that if you need to but now when I come back here it allows you to filter by specific tags and you can then remove tags if necessary but you can also filter by this. So you can think of tags as similar to folders. You can organize it if you have specific conversations you want to put in different tags depending on the topics, you can do that and all the configuration page for private messages that had the tags on it, all that does is list the different tags that are in use and lets you know if they’re public.

Basically what that means is my tags that I’m creating are only available to me and it tells me how many times this tag has been used. There also are ways to I believe make tags public so anyone can use those tags but we won’t go over that this time. So that’s really all there is to those modules, we also went to some of the other core ones like blocking user messages, e-mail notifications prior message filtering, the limits and the roles, we’re not going to go the real name or rules integration although those are also well built and can be helpful on specific sites.

So that’s it for this time on the Daily Dose of Drupal. Hopefully you learned a little bit about how to enhance just the basic Private Message Module with some of the other additional modules that come with it and how you can build a very flexible private messaging system on a Drupal 7 website. As always; follow me on Twitter if you’re not already and we will see you next time with another episode. Thanks for watching.


this is beautiful website and i am watching your video training everyday.
this tutorial is the best module training for drupal developers.
good job and thank you

hi it is posible create video tutorial with Welcome message after validation (logintoboggan) drupal 7

thank you

Hi Shane,

do you know why this module doesn't send mail notifications when we send a private message to a specific rol?

Thank you for your great tutorials.

Post new comment