Force anonymous users to log-in

Created on 6 January 2014, almost 11 years ago
Updated 2 September 2024, 4 months ago

I wanted anonymous users to see full rating widget, but when trying to vote be foreced to log in or register (use voting as a catch!).

The attached patch makes that possible, but it is just a proof of concept working only for ajax submit of form, and it will prevent anonymous users from being able to vote unless they are loged in.

Feature request
Status

Needs work

Version

3.0

Component

Code

Created by

🇪🇸Spain david_garcia

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

Comments & Activities

Not all content is available!

It's likely this issue predates Contrib.social: some issue and comment data are missing.

  • 🇳🇬Nigeria chike Nigeria

    Using Fivestar in Drupal 10 now and I am still struggling to stop anonymous users from voting. I want only a custom user role to be able to vote.

    Is this available in the module yet?

  • 🇳🇬Nigeria chike Nigeria

    There is a 'rate_content' permission but even thought I set it to allow only one role to be able to rate users (I have fivestar on user accounts not content), anonymous users and every other user roles are still able to rate users. I am not sure if the problem is that I have fivestar on user accounts and not nodes (content). I have not tried if the permission works for nodes.

  • 🇺🇸United States tr Cascadia

    @chike: The "rate content" permission has not been fully ported from Drupal 7 yet. Please contribute to 🐛 Rate content permission is not ported to D8 Needs work

  • First commit to issue fork.
  • Open in Jenkins → Open on Drupal.org →
    Core: 9.5.5 + Environment: PHP 7.3 & MySQL 5.7
    last update about 1 year ago
    4 pass
  • @souvik_banerjee opened merge request.
  • 🇮🇳India souvik_banerjee

    Hi, I have added code so that anonymous users are redirected to the login page when they try to cast their vote.

  • Status changed to Needs review about 1 year ago
  • Status changed to Needs work about 1 year ago
  • 🇺🇸United States tr Cascadia

    I don't think #7 is usable as-is.

    First, it ALWAYS redirects anonymous users to the login page, whether or not anonymous users have the "rate content" permission.

    Second, you don't add any configuration options to enable/disable this feature. Not everyone will want this, and your default values change the behavior of this module for existing sites.

    Third, if this is done, it should work with the permission, and as stated above the permission does not work yet in the 8.x-1.x branch. This is the first thing that needs to be fixed, with a test case to demonstrate it works and to prevent it from being broken in the future.

    I personally think that redirects like this should not be done in this module. This use case of redirect to somewhere if the permission is not present is very common for many applications. Hardwiring it to the Fivestar module without configuration options is a very limited use case, and it does nothing to address all the other use cases - in essence you would have to re-create this feature for every contributed module which wanted anonymous users to log in before doing something. See for example https://www.drupal.org/node/60148 and https://www.drupal.org/project/r4032login

  • 🇺🇸United States tr Cascadia

    New features should go into the latest version of Fivestar first.

Production build 0.71.5 2024