PHPackages                             bluemantis/private-messaging - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. bluemantis/private-messaging

ActiveCraft-plugin

bluemantis/private-messaging
============================

Allows sending private messages between users

1.0.3(7y ago)357[1 issues](https://github.com/blue-mantis/craft-private-messaging/issues)MITPHP

Since Mar 19Pushed 7y ago3 watchersCompare

[ Source](https://github.com/blue-mantis/craft-private-messaging)[ Packagist](https://packagist.org/packages/bluemantis/private-messaging)[ RSS](/packages/bluemantis-private-messaging/feed)WikiDiscussions master Synced 2d ago

READMEChangelogDependencies (1)Versions (4)Used By (0)

Craft Private Messaging
=======================

[](#craft-private-messaging)

A Craft 3 CMS plugin. Grant your site users the power of communication, via private messaging!

[![screenshot](https://camo.githubusercontent.com/33e30ebb0c970664237c62649cf7ae5547b7b87ee446b4c77a6f20183d1f454c/687474703a2f2f692e696d6775722e636f6d2f5150474b774f692e706e67)](https://camo.githubusercontent.com/33e30ebb0c970664237c62649cf7ae5547b7b87ee446b4c77a6f20183d1f454c/687474703a2f2f692e696d6775722e636f6d2f5150474b774f692e706e67)

User Guide
==========

[](#user-guide)

### 1. Send a private message

[](#1-send-a-private-message)

Add the following form to your template:

```

    {{ getCsrfInput() }}

    Subject

    Message

```

You will need to set the following form values:

- **redirect** - This should be set to the template to redirect to, upon successfully sending the private message
- **subject** - This should be the subject of the message
- **body** - This should be the content of the message
- **recipientId** - This should be the ID of the user due to receive the message

### 2. View messages

[](#2-view-messages)

To view the logged in users messages, you will need to add the following to your template:

```
{% for message in craft.privateMessaging.messages %}

{% endfor %}
```

Within this loop you can access the following private message attributes:

- **message.id** - The message ID. \[**type**: *integer*\]
- **message.subject** - The subject of the message. \[**type**: *string(255)*\]
- **message.body** - The body of the message. \[**type**: *text*\]
- **message.sender** - The sender user. \[**type**: *user object*\]
- **message.recipient** - The recipient user. \[**type**: *user object*\]
- **message.siteId** - The id of the site. \[**type**: *integer*\]
- **message.thread** - The message thread. \[**type**: *thread object*\]
- **message.isRead** - Whether the message has been read. \[**type**: *boolean*\]
- **message.dateCreated** - The created dateTime of the message. \[**type**: *dateTime*\]

### 3. View unread message count

[](#3-view-unread-message-count)

To view the unread message count for the currently logged in user, you will need to add the following to your template:

```
{{ craft.privateMessaging.unreadMessageCount }}
```

### 4. View total message count

[](#4-view-total-message-count)

To view the total message count for the currently logged in user, you will need to add the following to your template:

```
{{ craft.privateMessaging.totalMessageCount }}
```

### 5. View a message

[](#5-view-a-message)

To access an individual message, you will need to pass the id of a message to your template.

This can be achieved by setting up a new route that passes the message id (number) to your template, like so:

[![screenshot](https://camo.githubusercontent.com/0e1407a57d977fa4c24c825a66fabd1da0ac14b645fbdb63a8c13ca419dbe645/687474703a2f2f692e696d6775722e636f6d2f61703859414d4a2e706e67)](https://camo.githubusercontent.com/0e1407a57d977fa4c24c825a66fabd1da0ac14b645fbdb63a8c13ca419dbe645/687474703a2f2f692e696d6775722e636f6d2f61703859414d4a2e706e67)

Inside the template, we will use this ID (number) to retrieve the message, but, first we check to ensure we have actually been passed an ID:

```
{% if number is not defined %}
    {% exit 404 %}
{% else %}
```

If we have an ID, then we pass this to the getPrivateMessage method (which is a twig extension built into the plugin):

```
{% set message = number|getPrivateMessage %}
```

If this method does not return an associated message, it will return null. We may wish to handle that also:

```
{% if not message %}
    {% exit 404 %}
{% endif %}
```

**The getPrivateMessage method with return a null value when:**

1. **Out of range** - *A message with that ID doesn't exist in the database*
2. **Deleted** - *A message with that ID has been deleted from the database*
3. **Permissions** - *A message with that ID does not belong to the user trying to access it*

### 6. View threads

[](#6-view-threads)

To view the logged in users threads, you will need to add the following to your template:

```
{% for thread in craft.privateMessaging.threads %}

{% endfor %}
```

Within this loop you can access the following message thread attributes:

- **thread.id** - The message ID. \[**type**: *integer*\]
- **thread.subject** - The subject of the message. \[**type**: *string(255)*\]
- **thread.excerpt** - The body of the message. \[**type**: *text*\]
- **thread.siteId** - The id of the site. \[**type**: *integer*\]
- **thread.dateCreated** - The created dateTime of the message. \[**type**: *dateTime*\]
- **thread.messages** - Array of messages in this thread. \[**type**: *array*\]

Inside the template, we will use this ID (number) to retrieve the message, but, first we check to ensure we have actually been passed an ID:

```
{% if number is not defined %}
    {% exit 404 %}
{% else %}
```

If we have an ID, then we pass this to the getPrivateMessageThread method (which is a twig extension built into the plugin):

```
{% set thread = number|getPrivateMessageThread %}
```

**The getPrivateMessageThread method with return a null value when:**

1. **Out of range** - *A thread with that ID doesn't exist in the database*
2. **Deleted** - *A thread with that ID has been deleted from the database*
3. **Permissions** - *A thread with that ID does not belong to the user trying to access it*

Threads are only visible to the parties involved in the conversation

### 7. Reply to a message

[](#7-reply-to-a-message)

Add the following form to your template:

```
{% set message = number|getPrivateMessage %}

		{{ getCsrfInput() }}

			Message

```

You will need to set the following form values:

- **redirect** - This should be set to the template to redirect to, upon successfully sending the private message
- **threadId** - This should be the ID of the conversation thread (use thread id of the message you're replying to
- **recipientId** - This should be the ID of the user you're sending the message to
- **subject** - This should be the subject of the message
- **body** - This should be the content of the message

### 8. Delete a message

[](#8-delete-a-message)

Add the following form to your template:

```

    {{ getCsrfInput() }}

```

**You will need to set the following form values:**

- **redirect** - This should be set to the template to redirect to, upon successfully deleting the private message
- **id** - This should be the ID of the message

NB: A user can only delete messages that belong to them.

More plugins by Blue Mantis
===========================

[](#more-plugins-by-blue-mantis)

... can be found [here](http://plugins.bluemantis.com/)

###  Health Score

27

—

LowBetter than 49% of packages

Maintenance13

Infrequent updates — may be unmaintained

Popularity12

Limited adoption so far

Community8

Small or concentrated contributor base

Maturity62

Established project with proven stability

 Bus Factor1

Top contributor holds 100% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~24 days

Total

3

Last Release

2564d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/2b3680455c9487616d85b8f0b39f7ad065bb5f016e923d192625ab471acb94cb?d=identicon)[bluemantis](/maintainers/bluemantis)

---

Top Contributors

[![auralon](https://avatars.githubusercontent.com/u/9267704?v=4)](https://github.com/auralon "auralon (1 commits)")

---

Tags

cmsCraftcraftcmscraft-pluginprivate messaging

### Embed Badge

![Health badge](/badges/bluemantis-private-messaging/health.svg)

```
[![Health](https://phpackages.com/badges/bluemantis-private-messaging/health.svg)](https://phpackages.com/packages/bluemantis-private-messaging)
```

###  Alternatives

[nystudio107/craft-seomatic

SEOmatic facilitates modern SEO best practices &amp; implementation for Craft CMS 5. It is a turnkey SEO system that is comprehensive, powerful, and flexible.

1741.4M46](/packages/nystudio107-craft-seomatic)[verbb/image-resizer

Resize assets when they are uploaded.

127269.1k7](/packages/verbb-image-resizer)[verbb/tablemaker

Create customizable and user-defined table fields.

40168.8k1](/packages/verbb-tablemaker)[wrav/oembed

A simple plugin to extract media information from websites, like youtube videos, twitter statuses or blog articles.

36205.0k3](/packages/wrav-oembed)[verbb/hyper

A user-friendly links field for Craft.

24130.9k9](/packages/verbb-hyper)[verbb/social-poster

Automatically post entries to social media.

918.5k](/packages/verbb-social-poster)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
