blog image

Popup Message - Review of a Module for Drupal

Displaying messages in a pop-up window on a website is a frequent need for website editors. That is why the Popup Message module was created. Check out what specific possibilities can this module offers you.

Popup Message is my first Open Source module published on drupal.org. It was created for the needs of the Dialogownia intranet system, the description of which can be found in the Case Study section

Dates 

I have published the module in 2011 for Drupal version 6. Over the years, versions for Drupal 7 and later – for Drupal 8 have appeared. The latest version was released on 5 March 2020.

Module's popularity

6,000 websites currently use the module – that is quite a number. The module has been downloaded over 30,000 times from the https://www.drupal.org/project/popup_message page

Module's creators

I have created the first version of the module for the needs of a client's project. Now, our Drupal development experts are further developing it. 

The module is enriched with several functionalities made by other developers and added via patches available on drupal.org.

16 people have worked on the module's code. You can find the full list of people here: https://www.drupal.org/node/1297230/committers?sort=desc&order=Commits 

Taking a look even at such a small module can help you see the strength of the Drupal community – they are working together to develop modules and the Drupal's core.

What is the module used for? 

The module's programming is not complicated, but it is often useful for website administrators. It is most often used if:

  • the company's office will be closed on certain days and you need to clearly inform your website visitors about it,
  • the company's headquarters address has changed
  • a new special offer for a product or service has appeared and you want as many people as possible to find out about it,
  • a new product or service has appeared, and you want to inform about it as many people as possible,
  • the company plans to participate in a fair and wants its potential client to be notified about it.

These are just a few examples. The main concept is about providing a clear message to the visitor. A message that they cannot miss. 

Unboxing

You can download the module at https://www.drupal.org/project/popup_message

After the installation, set the module's permissions on the "/admin/ people/permissions" page. 

The module has two types of permissions: "Administer Popup message module" and "Display popup message".

The "Administer Popup message module" permission allows you to configure the message text and to decide on which pages a given message is to be displayed.

The users with the "Display popup message" permission will see the message. This permission allows you to limit the messages, e.g. to the logged-in users only or only to the users with a specific role. Here is another example of its use: The administrator can display an important message for the users with the Editor role. 

Module's use 

After defining the roles, you can now use the module and set the message to be displayed. All the module's settings can be found on a single configuration page at: "/admin/config/user-interface/popup-message."

Module use_01

The first option is to enable or disable the display of messages. You have the option to manually control when you want to show the message on the website. For example, you can prepare the text but turn on the window after a few days (e.g. when the special offer for the product will launch).
n the "message title" and "message body" fields enter the content that the user will see. 

Module use_02

The module allows you to change the window's behaviour. You can change the size, the display delay, and set the amount of time after which the window will close automatically. It is also possible to set the background's transparency and the window's colour. 

Module use_03

In the next settings section, you will adjust the cookie retention rules and choose the pages on which the module is to be displayed. 
The combination of all these options gives you a lot of possibilities, and that is not all you can do with the module.

Hooks

The module also has options for additional settings control from the level of another module's code through the built-in popupmessageparametersalter ($parameters) hook. 

Hooki

All parameters from the settings can be overwritten in the code. This allows for more flexible control of the module, e.g. you can dynamically generate the content of the message or better control on which pages to display the window. 

Summary

The Popup Message module is a simple, but also very helpful and often-used module. If you need to inform the users of your website about something, this module will help you do it within just a few minutes. 

As part of Drupal support, we maintain existing websites and expand them with new functionalities