There are sometimes situations where a site administrator may want to limit the messaging abilities of certain roles. For instance, a site that is used by a school as a digital classroom may want to have full back-and-forth private messaging between the teacher and any student but NOT want the students to message each other. (Why? Experience shows that visible communication between students in grades 4-12 fosters civility and discourages sarcasm and harshness. Additionally, it could be distracting to the purpose of the site.)

Accomplishing this is simple, though a little counter-intuitive: You block a particular role from sending messages to that role. Note that you need to enable the module 'Block user messages' for this to work.

In this case, we have two primary roles on the site: "teacher" and "student." (If you haven't created these roles, go to Administer>>User management>>Roles to create the roles you need.)

  • Go to Administer>>Site configuration>>Private Messages>>User blocking rules
  • Click "Add new rule"
  • You will see four category headers with selection or check boxes underneath. Here should be your selections:
      "If the author has the role" Select: "student"
      "And the recipient has the role" Select: "student"
      "Action" Select: "Disallow sending message"
      "Enabled" Check the box
      Press the "Save configuration" button

You have now prevented a role, in this case "student", from sending messages to another user with the student role. When a "student" user tries to send a message, he/she receives a message saying such action is prohibited. However, a "student" user can still send a message to or reply to a message from a user with the "teacher" role.

Comments

alioso’s picture

Hi there. Thanks for the tip. I was trying to follow this tutorial, but I can't seem to be able to access the Administer>>Site configuration>>Private Messages>>User blocking rules page. The "User blocking rules" is not showing in my admin. I tried with both the 6.1 and 6.2 dev versions, i am logged in as user/1 and I have all privatemsg modules activated.
What am i missing?

Berdir’s picture

Make sure that pm_block_user.module is enabled. This is supported in both versions, so this show up there... Maybe it's translated into something else if you are using a non-english language?

I'm not reading comments here regularly, so you might want to open support issues instead if you have questions.