INTRODUCTION
This module extends functionality of core messenger to handle situations when you want to leave a specific user with warning/error/info message on login event.
i.e. if system has applied an action against a user or any data related to him/her and you want to inform the user what happened beside any other notification method.
ROADMAP
I think this module can be more developed to
- Admin may leave specific message to users based on role
- not just leave a message on login but also on page refresh but i didn't check on performance of this
- admin may leave a custom warning for specific user through a form.
- Module structure can be more enhanced .
if you have an idea to extend, you are more than welcomed to create an issue.
REQUIREMENTS
This module requires no modules outside of Drupal core. but can be used with modules like Better Messages for better UX.
INSTALLATION
to get the module you can download and unzip it in contrib modules folder or better use composer to install the module and manage your dependencies:
$ composer require drupal/private_messenger
CONFIGURATION
You need to create an private messenger entity whenever needed and module will load this entity on login and show message and remove the entity to not flood its table. in future i will add a simpler method to send the message.
$message = \Drupal::entityTypeManager()->getStorage('private_messenger_message')->create([
'type' => 'warning',
'recepient_uid' => 5,
'message' => 'Dear @name, please update your profile info asap.'
]);
// Optional parameters in message.
$message->setParameters(['@name' => 'name')]);
$message->save();
IMOPORTANT NOTE
If you use version 1.3.0, you can send the message as 'message' => 'please update your profile info asap.', but in version 1.2.0 you have to send it within translation function 'message' => t('please update your profile info asap.'),
Project information
Minimally maintained
Maintainers monitor issues, but fast responses are not guaranteed.- Project categories: Site structure, Access control, Developer tools
- Ecosystem: Messenger
15 sites report using this module
- Created by mohamed nabawy on , updated
Stable releases for this project are covered by the security advisory policy.
Look for the shield icon below.

