Drupal

The petition management module, simple petition node, ported to Drupal 9

Published on 18 March 2022
Photo of a vote during a UX workshop bluedrop.fr - It's kind of like a petition, actually...
The module, originally contributed for Drupal 8 by the bluedrop.fr team, has just been ported to 9. Used on CGT websites, it is available to all Drupal 9 users.

An easy-to-use module for managing petitions on Drupal

Simple Petition Node (SPN) is a petition extension for Drupal 8 that allows you to manage petitions for your users.

The module lets you create one or more petitions, manage notifications, and display the results.

Installation & Features

Simple Petition Node (SPN) can be enabled like any other Drupal extension. During installation, the module creates a "Petition" content type with predefined fields (Title, Body, Validation and Confirmation Emails) and adds two blocks (the petition signature form and the petition results block), which can be managed in Drupal's back office.

A configuration page is available at /admin/config/spn/notifications to manage the default notification messages for all petitions. Tokens are available for using variables related to the petition.

Additionally, SPN adds two tables to the Drupal schema, [Petition Signatures] and [Petition Users]. The first contains each signature's data, and the second stores information about the anonymous signatory users.

Usage

The process of "creating a petition" is the same as adding any Drupal content. Note that if the email fields of a content item are left empty, the module will use the default emails defined on the module's configuration page (/admin/config/spn/notifications).

After creating the content, the user must add the two blocks to the desired pages. Go to /admin/structure/block and add the blocks to your preferred region of the page. Template suggestions are available to change the layout of the blocks and take control of the structure and design of each block. Block controllers operate by following the route of the page they are on.

Signing a petition

To sign a petition, users can be logged in or anonymous. They are asked to provide the requested information and may add a comment if they wish. They can also choose to sign anonymously if the corresponding field is checked—their information and comments will not appear in the results block, but their vote will be counted. After signing, the subscriber will receive an email notification with a link to validate their signature; otherwise, their vote will not be recorded.

Exporting signatures to a CSV file

Introduced in version 2.0.0, administrators can now export signatures on the configuration page at /admin/spn/content/petitions. Make sure the "private" directory is correctly configured on your server by checking that the "Private file system path" is assigned on the page /admin/config/media/file-system.

Extensions

Some extensions are being developed for future versions, such as petition page management, petition field administration, PDF export, and permission management.

Credits:
Simple Petition Node is developed and maintained by bluedrop.fr.

Accredited by the Confédération Générale du Travail - CGT.

Read more articles on Drupal