Conditional message demo

Display a custom message anywhere on the page if the configured conditions are met. The goal is to provide quick messages, notifications or alerts that are easy to set up and flexible enough to cover most use cases.

The typical scenario for this module is to show a small piece of information to a targeted audience like:

  • user is logged out, invite them to log in or register
  • notify about an on-going event (e.g. sales, live video, site maintenance...)
  • alert users, editors or even administrators about something that requires attention
  • promote a product or highlight a given content type
  • disclaimer about using cookies on the site for compliance with regulations
  • ask if user wants to subscribe to your newsletter or something in a non-invasive manner

Easy: offers predefined options for extra easy configuration (no dependencies!).
Flexible: customize message (allows HTML), configure background color and place it anywhere on the page.
Performant: conditions are checked via AJAX allowing it to work with any kind of cache (drupal cache, memcache or varnish).

Features

At this time the module provides the following conditions out of the box:

  • Display once per session
  • Until the user closes the message
  • Display to certain user roles
  • Display on certain paths
  • Display on certain content types
  • Display on certain multi-sites (D7 only, requires configuration of conditional_message_client)

How to use

On drupal 8/9/10+

  1. install the module as you normally would
  2. create new conditional messages at /admin/content/conditional-message
  3. configure the message, conditions and color/position for the message to blend in your site

On drupal 7

  1. install the module as you normally would
  2. go to the configuration page at admin/config/user-interface/conditional-message
  3. configure the message, conditions and color/position for the message to blend in your site

The message will appear when the conditions are met!

Project information

Releases