Skip to main content

Role-Based Access Control

Better Messages includes a role-based send-permission system — pick the WordPress roles that are allowed (or forbidden) to send messages, set a custom error message for blocked senders, and put per-role rate limits on top so high-volume roles can't be used to spam threads.

What it adds#

  • Allow or Disallow mode for role-based send permission
  • A single per-role list that defines who is in (or out, depending on the mode)
  • Custom error message shown to blocked senders
  • Per-role rate limits on replies (configurable per role, per time window)
  • Site-wide minimum delay between new conversations
  • Companion features: user-to-user block, MyCred / GamiPress points, and pre-moderation for richer policies

How it works#

The system checks the sender's role against the configured policy on every message send:

  1. Mode = Allow — only roles in the list can send. Everyone else is blocked.
  2. Mode = Disallow — roles in the list are blocked. Everyone else can send.
  3. Reply rate limit — if the sender's role has a per-time-window cap, replies above the threshold are blocked until the window resets.
  4. New-conversation rate limit — a minimum number of seconds between starting new threads, site-wide.

A failed check rejects the send with the configured error message.

ModeEffect
AllowSender's role must be in the configured list. Roles not in the list are blocked.
DisallowSender's role must NOT be in the configured list. Roles in the list are blocked.

Common policy patterns#

Site typeExample configuration
MarketplaceDisallow customer from starting new conversations more than once per 30 seconds. Allow vendors / shop managers freely
LMSAllow only instructor, course-leader, and subscriber to use the messenger. Rate-limit subscriber to 30 replies per hour
Membership siteDisallow subscriber (free tier) from sending. Allow paid roles
Public communityAllow only verified roles. Combine with the user-block feature for individual safety
Anti-spam baselineEnforce a 30-second minimum between new conversations site-wide

Rate limiting examples#

Use caseRate limit
Free-tier guard railssubscriber → 50 replies per day
High-volume vendor roleNo reply limit, but enforce 30s between new threads
Anti-spam baseline30-second minimum between new conversations (site-wide)

How to enable#

Navigate to WP Admin → Better Messages → Settings → Restrictions.

  • Default Behavior — All users can message each other or No one can message each other, with Role-to-Role Restrictions for the exceptions
  • Restricted Roles — the roles that are in or out, depending on the mode
  • Restriction Message — text shown to a blocked sender

The rate limits are on Settings → Moderation → Rules from 3.3.0, and on Settings → Restrictions before it. They hold whatever the level of Spam Protection is, Off included:

  • Reply Rate Limit — per-role cap on replies, a count per hour or per day. From 3.3.0 only the roles with a limit are listed, and Add a limit for a role adds one
  • Message When Limited (Rate Limit Message before 3.3.0) — text shown when the cap is hit
  • New Conversations (New Conversation Rate Limit before 3.3.0) — minimum seconds between starting new conversations, with Message While Waiting for the text shown meanwhile

Restrict or allow only#

Compatibility
This feature compatible with Better Messages 3.3.0 or higher

Every role list of the settings works both ways. Two radio buttons above the checkboxes say what the ticked roles mean:

  • Restrict selected roles — the ticked roles are refused and every other role is let through. This is how the lists worked before 3.3.0.
  • Allow only selected roles — the ticked roles are let through and every other role is refused.

On a site with many roles, Allow only is the short way to say "only Customers and Vendors can reply": tick those two instead of every other role. A role that another plugin adds later is refused until it is ticked.

The Restrict Replies card of Settings, Restrictions: Allowed Roles with the radio button Allow only selected roles chosen and the Select all and Deselect all buttons at the far end of the same row, Customer and Vendor ticked among the roles of the site, and the Restriction Message field under the list

The two modes are on these lists:

ListWhere
Restrict New Conversations, Restrict Replies, Restrict Message ViewingSettings → Restrictions
Hide Chat Button for RolesSettings → Restrictions → Floating Chat Button
Cannot Block Others, Cannot Be BlockedSettings → Restrictions → User Blocking
Call RestrictionsSettings → Calls
Restricted from Starting, Restricted from JoiningSettings → Group Calls
Voice Messages Restrictions, Video Messages RestrictionsSettings → Voice Messages, Settings → Video Messages
Restricted Roles of locations and pollsSettings → Location, Settings → Polls
Hide from Roles of each widget, one choice for its three columnsSettings → Widgets
Invisible ModeSettings → Messaging
Roles allowed to translateSettings → Translation
Show users with specific rolesSettings → Widgets → Users → Users to Display

The last three always named the roles that get something, so they start on Allow only selected roles (or Show only selected roles) and can be turned to Allow all except selected roles.

How the two modes behave:

  • Choosing the other mode inverts the ticks, so at that moment the same roles are let through as before. Then tick the roles you want and press Save Settings. Nothing changes for members until the settings are saved.
  • Select all and Deselect all at the end of the same row tick or untick every role of the list at once, and on a widget every role of its three columns. A role locked by another setting, such as a role that cannot join group calls in the list of who may start them, stays as it is.
  • Administrators are never restricted by these lists, in either mode. With Allow only and no role ticked, only administrators are let through, and a line under the list says so. The Users widget is the exception: there nobody is let through, and an administrator counts as one more role that is not ticked.
  • A member with several roles is refused by Restrict when any of their roles is ticked, and let through by Allow only when any of their roles is ticked. So the one member whose access can change at the moment of choosing the other mode is someone with two roles where only one was ticked.
  • Lists saved before 3.3.0 keep working as they did. They stay on Restrict selected roles. The translation list keeps its meaning too: an empty list lets every role translate, and a list with roles ticked lets only those roles.

The role-to-role rules above have their own Default Behavior and do not have these two modes.

Frequently asked questions#

Are admins exempt from these rules?#

Accounts with manage_options bypass the bad-words filter when Skip Administrators is on. Role-based access applies to administrators like any other role — list them under All users can message each other or leave them out of the restricted set to keep them unrestricted.

What error message does a blocked user see?#

The text from Restriction Message (or Message When Limited when the rate limit is the cause). The first is set on the Restrictions tab, the second under Settings → Moderation → Rules.

How do the rules interact with user-to-user block?#

Both apply — a user-to-user block and a role restriction each have to pass for the message to send. Either rejection blocks the message. Role rules are admin-set. User blocks are user-set.

Can I create custom roles for this?#

Yes — the rule system reads ANY WordPress role, including custom ones added by other plugins. Define the roles there, then pick them in the Better Messages restrictions.

Can I restrict messaging by membership level instead of role?#

Membership levels are not WordPress roles, so they don't appear in the role lists. Two ways to connect them:

  • Give each level a role. For Paid Memberships Pro, the PMPro Roles add-on creates a WordPress role for every membership level and keeps it in sync. Then pick those roles in the restrictions here.
  • Map memberships in code. The better_messages_get_user_roles filter changes the roles these rules see, so any membership plugin can decide them. Its page has a MemberPress example where only VIP members can start conversations.

A custom rule written with better_messages_can_send_message only covers sending in existing conversations. Pair it with better_messages_before_new_thread to cover starting conversations too.

Does a member's own "who can start conversations" choice stop replies?#

No. With User Conversation Restrictions on (Moderation → Message Requests from 3.3.0, Restrictions → User Controls before it), members can choose who may start conversations with them, and that choice only applies to new conversations. Conversations that already exist keep working. To stop one person replying, the member can block them (User Block). To stop whole roles replying, use Restrictions → Restrict Replies.

What about guests / non-logged-in users?#

Guests have a synthetic bm-guest role and can be picked in the Restrictions role list. Combine that with the per-chat-room Allow guests toggle to control where guests can chat.

See also#