Private Message
The Private Message module allows for private messages between users on a site. It has been written to be fully extendable using Drupal 8 APIs.
For a full description of the module, visit the project page.
Submit bug reports and feature suggestions, or track changes in the issue queue.
Table of contents
- Requirements
- Installation
- Configuration
- Maintainers
- Contribute
Requirements
This module requires no modules outside of Drupal core.
Installation
Install as you would normally install a contributed Drupal module. For further information, see Installing Drupal Modules.
Configuration
- Navigate to Administration > Extend and enable the Private Message module.
- Navigate to Administration > People > Permissions and give the two permissions (use private messaging system, access user profiles) to the roles that should use the messaging system. Save permissions.
- To write a private message to another user, navigate to the path /private-messages.
Configuring the Private Message Inbox Block
- Navigate to Administration > Structure > Block Layout.
- Find the Private Message Inbox Block and select the Configure button.
- Give the block a title.
- Select the number of threads to show in the block.
- Select the number of threads to be loaded with ajax.
- Select an Ajax refresh rate. This is the number of seconds between checks if there are any new messages. Note: setting this number to zero will disable refresh and the inbox will only be refreshed upon page refresh.
- In the Visibility horizontal tab section there are three options for visibility: Content types, Pages and Roles.
- The user may also want to set the block to only show on the following
paths:
- /private-messages
- /private-messages/* This will limit the block to only show on private message thread pages.
- Select to region for block display from the Region dropdown.
- Save block.
Configuring the Private Message Notification Block
- Navigate to Administration > Structure > Block Layout.
- Find the Private Message Notification Block and select the Configure button.
- Give the block a title.
- Select an Ajax refresh rate. This is the number of seconds between checks if there are any new messages. Note: setting this number to zero will disable refresh and the inbox will only be refreshed upon page refresh.
- In the Visibility horizontal tab section there are three options for visibility: Content types, Pages and Roles.
- Select to region for block display from the Region dropdown.
- Save block.
To Configure Private Message Threads
- Navigate to Administration > Structure > Privates Messages > Private Message Threads.
- Select the Manage fields tab and fields can be added as with any other entity.
- Select the Manage display to order the items in a thread.
- Save block.
For other use stories and configurations, please visit
https://www.drupal.org/node/2871948
Note: if Bartik is not the enabled theme, the Private Message Inbox block will need to be placed in a region somewhere on the page.
Contribute
DDEV, a Docker-based PHP development tool for a streamlined and unified development process, is the recommended tool for contributing to the module. The DDEV Drupal Contrib addon makes it easy to develop a Drupal module by offering the tools to set up and test the module.
Install DDEV
- Install a Docker provider by following DDEV Docker Installation instructions for your Operating System.
- Install DDEV, use the documentation that best fits your OS.
- DDEV is used mostly via CLI commands. Configure shell completion & autocomplete according to your environment.
- Configure your IDE to take advantage of the DDEV features. This is a critical
step to be able to test and debug your module. Remember, the website runs
inside Docker, so pay attention to these configurations:
- PhpStorm Setup
- Configure PhpStorm and VS Code for step debugging.
- Profiling with xhprof, Xdebug and Blackfire.
Checkout the module
Normally, you check out the code form an issue fork:
git clone git@git.drupal.org:issue/private_message-[issue number].git
cd private_message-[issue number]
Start DDEV
Inside the cloned project run:
ddev start
This command will fire up the Docker containers and add all configurations.
Install dependencies
ddev poser
This will install the PHP dependencies. Note that this is a replacement for Composer install command that knows how to bundle together Drupal core and the module. Read more about this command at https://github.com/ddev/ddev-drupal-contrib?tab=readme-ov-file#commands
ddev symlink-project
This symlinks the module inside web/modules/custom
. Read more about this
command at https://github.com/ddev/ddev-drupal-contrib?tab=readme-ov-file#commands.
Note that as soon as vendor/autoload.php
has been generated, this command runs
automatically on every ddev start
.
This command should also be run when adding new directories or files to the root of the module.
ddev exec "cd web/core && yarn install"
Install Node dependencies. This is needed for the ddev eslint
and ddev stylelint
commands.
Install Drupal
ddev install
This will install Drupal and will enable the module.
Changing the Drupal core version
- Create a file
.ddev/config.local.yaml
- In the new config file, set the desired Drupal core version. E.g.,
web_environment: - DRUPAL_CORE=^10.3
- Run
ddev restart
Refer to the original documentation: Changing the Drupal core version
Run tests
-
ddev phpunit
: run PHPUnit tests -
ddev phpcs
: run PHP coding standards checks -
ddev phpcbf
: fix coding standards findings -
ddev phpstan
: run PHP static analysis -
ddev eslint
: Run ESLint on Javascript and YAML files. -
ddev stylelint
: Run Stylelint on CSS files.
Maintainers
- Artem Sylchuk - artem_sylchuk
- Jay Friendly - Jaypan
- Philippe Joulot - phjou
- Lucas Hedding - heddn
- Anmol Goel - anmolgoyal74
- Eduardo Telaya - edutrul
- Claudiu Cristea - claudiu.cristea
Supporting organizations: