# Allow sending Private Messages to Staff

**URL:** <https://meta.discourse.org/t/allow-sending-private-messages-to-staff/75366>\
**Category:** Feature\
**Created:** [2017年十二月4日 20:00 UTC](https://meta.discourse.org/t/allow-sending-private-messages-to-staff/75366 "2017-12-04T20:00:58Z")\
**Posts on this page:** 1\
**Showing post:** 5

<div class="post-metadata">

**Author:** ![angus](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/angus/32/341715_2.png) [@angus](https://meta.discourse.org/u/angus)\
**Post date:** [2017年十二月5日 01:08 UTC](https://meta.discourse.org/t/allow-sending-private-messages-to-staff/75366/5 "2017-12-05T01:08:26Z")

</div>

If I’m reading you right, you want to restrict the target of pms to staff only?

You could do this relatively easily in a standalone plugin. The plugin.rb would read:

```plaintext
# name: only-pms-to-staff
# about: You can only send pms to staff
# version: 0.1
# authors: pfaffman

after_initialize do
  add_to_class('guardian', :can_send_private_message?) do |target|
    target.is_a?(User) &&
    # User is authenticated
    authenticated? &&
    # Have to be a basic level at least
    @user.has_trust_level?(SiteSetting.min_trust_to_send_messages) &&
    # User disabled private message
    (is_staff? || target.user_option.allow_private_messages) &&
    # PMs are enabled
    (is_staff? || SiteSetting.enable_private_messages) &&
    # Can only send pms to staff
    target.staff?
  end
end

```

The original method is [here](https://github.com/discourse/discourse/blob/master/lib/guardian.rb#L288).

See also: [How do disable private messages between non staff users? - #10 by Mittineague](https://meta.discourse.org/t/how-do-disable-private-messages-between-non-staff-users/31436/10)

---

_[View the full topic](https://meta.discourse.org/t/allow-sending-private-messages-to-staff/75366)._
