This project is not covered by Drupal’s security advisory policy.

Private Message Advanced gives every conversation in Private Message an info page, the way iMessage, Telegram and WhatsApp have one: a Details page that shows who is in the conversation and lets its members change it.

On the Details page a member can:

  • Name the conversation. The name replaces the list of participants everywhere the thread is shown. Clear it and the names come back.
  • Add people. Adding to a group puts them in that group. Adding to a one-on-one starts a new group with the same two people plus the newcomers, so the one-on-one keeps its history, the way the messaging apps behave.
  • Manage the members. Remove someone from the conversation, or leave it yourself. A one-on-one cannot be left or trimmed; a group can.

Each change posts a system line into the conversation ("Alex added Sam", "Sam left the conversation", "Alex named the conversation Rooftop shoot"), so everyone in it sees what happened. Someone added later sees only what was said after they joined. Each operation has its own permission, and a setting caps how many people a conversation can hold.

It works on the released 4.x Private Message with no patch, and changes nothing about existing threads or messages. The Details link is on the thread page from install and opens in a dialog.

Themeable

The page ships plain, so it looks like whatever your theme makes of it, and every piece of it is yours to change:

  • The page and its two sections (the header with the name, the members section) are three Twig templates you can copy into your theme, each with its own preprocess.
  • The member list is a View the module installs. Add your picture field to it, change the row style, reorder the columns, in the Views UI.
  • Naming and adding people are two ordinary forms, alterable with hook_form_FORM_ID_alter(). Remove, Leave and Delete are links to their own forms, so a site can open them in a dialog.
  • Every element carries its own CSS class, and the module's stylesheet is layout only.
  • An alter hook hands a site each member row's action, to add links or replace it with a menu.

The README lists every route, form id, template and hook, and walks through the common customizations, avatars included.

Why a separate module

Private Message identifies a thread by its exact set of members: that is how it finds "the conversation between these people." Adding leave, remove and add breaks that lookup, since once C leaves the A, B, C thread, it has the same members as the real A, B conversation, and a fix has to decide how Private Message tells the two apart. That decision needs the maintainers, and the issue queue shows no agreement on it across seven issues and several years. Rather than wait on that, this module makes its own decision (see "How it works" below) and ships as a separate module on top of Private Message. If the maintainers want it merged in, or want a different decision, I am all for it.

How it works

The members field stays the live roster, so every inbox query, unread count, access check and notification in Private Message follows a change with no further code. One small table records every join, leave and removal, and it carries the rule that dissolves the collision: a thread with any row in that table is reachable by its id only and is never again the answer to a member-set lookup. Threads that were never edited keep their uniqueness exactly as before. The rule is applied by swapping the module's thread service for a subclass that overrides the one lookup method.

In the database: one new table, private_message_advanced_log, and one new base field on the message entity, membership_event, which marks a system line as joined, left, removed or renamed. No existing data is modified.

Requirements

  • Private Message 4.0.0-alpha4 or later
  • Views

Project information

Releases