How to Add Voting System to Drupal 9

Do you need a voting system for your Drupal 9 website?

It is easy to add a voting system to Drupal 9 and let users vote on your published articles. To do so you would need to install some modules to Drupal. Some of the modules are not directly related to having a voting system but they are required for functioning the main module.

You would need to have these modules installed on your Drupal site:

If you are not using Composer, you would need to install them one by one manually by going to their project page and choosing .tar.gz or .zip file. Please keep in mind that some of the modules might be in beta state for Drupal 9 but you can still use them.

The process of installing any Drupal module is the same from the Admin panel. To do so, follow these steps:

  • Go to the admin panel of your Drupal site
  • Click on Manage -> Extend
  • Click on Add new module button
  • Copy the address of compressed module on the URL ox or upload the module’s file
  • Click on Continue button
Copy Module's URL and Click on Continue
Copy Module’s URL and Click on Continue

You would need to do the same for all 3 mentioned modules. After installing them, you should go and install them. To do so, go to this address http://yoursite.com/admin/modules (replace yoursite.com with your domain name) and mark all Voting API, VotingAPI Tokens and Votingapi Widgets and click on the Install button on the bottom of the page. Now the voting module is ready to use.

After all modules are installed successfully, you will see they are activated and no further marking is available for them like this image.

Now you need to configure the Voting module. To do so:

  • Go to the admin panel and click on Extend -> Configuration
  • Under the SEARCH AND METADATA section, click on the Voting API Settings
Click on voting API Settings
Click on voting API Settings

Now you will have the option to set the required interval for voting the same anonymous or registered users to vote on the same article and calculations schedule. Set these settings according to your needs and click on Save Configuration button.

Now you would need to create voting widgets that can be used in Articles or any node you would need voting on. Follow these steps:

Click on Manage -> Structure from the admin panel and then click on the Content types.

Click on Content Types
Click on Content Types

In front of the Article, click on Manage fields.

Click on Add field.

Click on Add field
Click on Add field

From the drop down menu, choose the Voting API field and choose a desired label for it. For example, here we type Vote This Article.

There are some possible options like: Five star rating and useful rating. You can choose one or multiple voting systems and then click on Save field settings. Here we choose fivestar rating as an example.

Now for each of your published articles, you see a rating system like below. The 5 star rating system has different choices from poor to very good.

Voting Articles
Voting Articles
You might also like
Leave a comment

This website uses cookies to improve your experience. We'll assume you're ok with this, but you can opt-out if you wish. Accept Read More