Use like feature as a toggle.

Created on 22 March 2024, 8 months ago

Problem/Motivation

I my usage of the module, I only use the like counter. I want to use it as a toggle:
One the user liked the content he wants to be able to remove is like by clicking again on the like button.

Steps to reproduce

Setup like/dislike in a content, click on like => like saved in the content.
click again => no action is recorded ("You have already liked..!" is send in background)

Proposed resolution

Get the possibility to change already clicked action from default to toggle (remove the like)

Remaining tasks

  1. Patch to switch to toggle behavior on like dislike buttons. I will post a patch here.
  2. Make it configurable

User interface changes

TBD to make it configurable.

API changes

N/A

Data model changes

N/A

Feature request
Status

Active

Version

2.4

Component

Code

Created by

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Merge Requests

Comments & Activities

  • Issue created by @pierreemmanuel
  • Patch for point number 1, use like as a toggle.

  • First commit to issue fork.
  • Status changed to Needs review 7 months ago
  • Open on Drupal.org →
    Core: 9.5.x + Environment: PHP 7.4 & MySQL 5.7
    last update 7 months ago
    Waiting for branch to pass
  • Please review the Merge request.

  • Status changed to Needs work 5 months ago
  • 🇮🇳India manish-31

    I believe it's not a good idea to change the feature completely. Instead, we should make it configurable by adding an option to configure the toggle behaviour while keeping the existing feature as is.

    Updating status to NW.

  • Assigned to sourabhsisodia_
  • Issue was unassigned.
  • Status changed to Needs review 5 months ago
  • Status changed to Needs work 3 months ago
  • 🇮🇳India Tirupati_Singh

    Hi, I've applied MR !11 as a patch and it applied with no errors. After applying, the configuration option has been provided for Enabling/Disabling the Like/Dislike as a toggle. On clicking Like the count value updates to 1 and again on clicking Like the count value updates to 0 and the same goes for Dislike also. The user is now able to Enable/Disable this Like/Dislike toggle feature by visiting the URL /admin/config/content/like-dislike and enabling Toggle Like/Dislike checkbox field. However, there's no menu link has been provided for visiting the configuration page for Enabling/Disabling the toggle behavior feature for Like/Dislike buttons. I've attached screenshots and a video clip for reference.

    Hence, moving the issue status to Needs work.

  • First commit to issue fork.
Production build 0.71.5 2024