Problem/Motivation

Hello, with Simplenews 4.0 the Webform Simplenews Handler 2.0.1 auto activates the subscription passing by the 'Verification of anonymous users' setting of the Simplenews module.

Steps to reproduce

Just use the Webform Simplenews Handler 2.0.1 version with Simplenews 4.0 and after subscribing an email through the Webform Simplenews Handler the subscription has status Active instead of Unconfirmed.

Proposed resolution

The Simplenews 4.0 method subscribe() of the subscriptionManager class no longer defines the $confirm as a function variable. A quick work around for me was to add the below line to SubscriptionManager.php (line 107)

$subscriber->setStatus(SubscriberInterface::UNCONFIRMED);

Command icon Show commands

Start within a Git clone of the project using the version control instructions.

Or, if you do not have SSH keys set up on git.drupalcode.org:

Comments

chrbak created an issue. See original summary.

Lukas von Blarer made their first commit to this issue’s fork.

luksak’s picture

I was quite confused by this. I think the simplenews 4.x release took the wrong path here... This is a very unintuitive API. And in my opinion very prone to errors. Take a look at this:

<?php
  /**
   * Checks if subscriber confirmation should be skipped.
   *
   * @return bool
   *   TRUE if confirmation should be skipped.
   */
  public static function skipConfirmation() {
    // Skip if logged in or if configured to skip.
    return \Drupal::currentUser()->id() || \Drupal::config('simplenews.settings')->get('subscription.skip_verification');
  }
?>

Any logged in user can skip confirmation to subscribe any email address. And this is on an API level.

luksak’s picture

Version: 2.0.1 » 2.0.x-dev

Here is a first draft to fix this issue.

luksak’s picture

Status: Active » Needs review

The MR is a hacky fix for this.

  • vuil committed ef02a1b1 on 2.0.x
    Issue #3444604 by luksak, chrbak, vuil: Verification of anonymous users...
vuil’s picture

Status: Needs review » Fixed

Now that this issue is closed, please review the contribution record.

As a contributor, attribute any organization that helped you, or if you volunteered your own time.

Maintainers, please credit people who helped resolve this issue.

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.