Drupal is a registered trademark of Dries Buytaert

alert_message

135 sites Security covered
View on drupal.org

Alert Message is a lightweight module that provides an easy way for administrators to display important temporary notifications to website visitors. These notifications can be configured to appear for anonymous users, logged-in users, specific individuals, or specific user roles.

Key Features

  • Dismissible Alerts: Users can click a notification to dismiss it for the duration of their browser session.
  • Customization Options: Administrators can create multiple messages with distinct visibility criteria. Messages can be displayed in the top highlighted area or within a dedicated section of the page. Additionally, alerts can be scheduled for future publication and removal via cron.
  • User and Role Targeting: Administrators can restrict alerts to specific groups based on assigned roles (e.g., editors, content authors) or individual usernames.
  • Translatable: All alert messages are fully translatable.
  • Custom Theming: The module includes a basic template, which developers can override to further customize the visual appearance of the alerts.
  • Lightweight: A minimal module with only one dependency: the Entity module.

How to Use

  1. Place the Alert Message block in the desired region of your layout.
  2. Create an alert message via the module's administrative interface.
  3. Hide non necessary fields from the alert message display
  4. Optionally, override the template file to customize the theme and appearance of your alerts.

How does this module compare to Notification Message?

The primary difference lies in the architectural approach. This module leverages Drupal core features to remain lightweight and relies on invalidating the alert message block cache to determine visibility. This method effectively prevents Cumulative Layout Shift (CLS).

Since version 1.1.0, the module has utilized Lazy Builders to render the block. This leverages the Dynamic Page Cache, which significantly improves performance and keeps the cache table size to a minimum.

Using with Varnish

This module is compatible with Varnish. However, due to how Drupal handles caching for anonymous users, the Dynamic Page Cache will always be used once a user dismisses an alert. Though, the page should be normally served via Varnish until the former happens.

Activity

Total releases
4
First release
Sep 2025
Latest release
1 month ago
Release cadence
49 days
Stability
75% stable

Release Timeline

Releases

Version Type Release date
1.1.1 Stable Feb 3, 2026
1.1.0 Stable Jan 9, 2026
1.1.x-dev Dev Jan 9, 2026
1.0.5 Stable Sep 9, 2025