Olafski's picture

A bug was recently discovered in the Simplenews module that can cause numerous newsletter subscriptions to be incorrectly deactivated. The bug was introduced in Simplenews version 1.x-1.2.2 and fixed in version 1.x-1.2.3. However, the fix does not include an option to reactivate newsletter subscriptions that were previously deactivated by mistake.

This forum post is intended to provide tips on how to restore affected newsletter subscriptions.

Comments

Olafski's picture

This is the report about the recently discovered bug: https://github.com/backdrop-contrib/simplenews/issues/83.

First, how do you know if your site is affected? In other words: Are there any incorrectly deactivated newsletter subscriptions on your site?

The number of subscriptions are listed by newsletter category at the path admin/config/services/simplenews.

If the numbers on that page look lower than expected, I'd recommend to build a Subscriptions view and check if there are any results with a source value of "blocked user":

  • Add a new view at admin/structure/views/add.
  • In the wizard, choose: Show Simplenews subscription.
  • Choose "Create a page", Display format: Table
  • Hit "Continue and configure".
  • Important: In the views configuration screen, in the middle column under "Access", add an access restriction choosing an admin permisson or an admin role.
  • Add the fields Status and Source to the view.
  • Under Filter criteria, add a filter for the Source field, choose the operator "Contains", and add the value "blocked".
  • Save the view, have a look at the results:
    Are there any results with Source "blocked user"? How many? More than you would have expected?

If you get more results with Source "blocked user" than expected, you may want to check if those are blocked user accounts (then the submissions have been disabled as expected) or if they are anonymous users (then the submissions have been disabled erroneously).

Olafski's picture

Restore Newsletter Subscriptions from a Database Backup

One of my websites was affected by the Simplenews issue, and there were many incorrectly disabled newsletter subscriptions of 'anonymous' users on the site.

Restoring the whole website from a backup wasn't an option in my case, as the website content had changed too much when I discovered the issue. I was however able to restore the submissions from a specific database table with the steps described below.

Prerequisites

  • The Simplenews module on the website has already been updated to the current version 1.x-1.2.3.
  • You have a database backup with an intact and largely up-to-date version of the simplenews_subscription table.

Restoring Subscriptions, Step by Step

Disclaimer: Restoring subscriptions requires editing the database, which is not without risk. Make sure you create a database backup, and only perform the following steps if you are comfortable working with a database.

  1. Set up a development website with an intact simplenews_subscription database table, or use an existing dev website with the intact table.
  2. Export the simplenews_subscription table from the dev website database, for example, using phpMyAdmin:
    • Go to the simplenews_subscription table and click the "Export" tab.
    • Check the "Custom - display all possible options" radio button.
    • Scroll down a bit and activate the "Add DROP TABLE / TRIGGER statement" option.
    • Click the "Export" button and save the SQL file on your computer.
  3. Go to your live website where newsletter subscriptions were mistakenly disabled.
  4. As a precaution, create a database backup, e.g. using the "Backup and Migrate" module.
  5. Import the simplenews_subscription table exported in step 2 into the table on your live website. Using phpMyAdmin:
    • Go to the simplenews_subscription table and click the "Import" tab.
    • Upload the SQL file you exported in step 2.
    • Click the "Import" button.
  6. Log in to your live website and check the number of subscriptions on the page with the path admin/config/services/simplenews. You can also use the view described in the previous comment.
  7. Once the subscription numbers are correct, run a cron job. If the numbers are still correct afterward, the subscriptions have been permanently restored.
Olafski's picture

Restore Newsletter Subscriptions from a Dev Website

In my last comment, I described a way to restore newsletter subscriptions from a database backup. The method involved directly editing the database, which is not without risk. Therefore, I describe an alternative approach here that utilizes the export and import functionality of the Simplenews module.

Prerequisites

  • You are able to use or install an older dev version of your Backdrop website from a backup. The site should contain Simplenews version 1.x-1.2.1 and an up-to-date list of newsletter subscriptions.
  • The Simplenews module on your live website has already been updated to the fixed version 1.x-1.2.3.

Step by Step

  1. Go to the dev website with the up-to-date list of newsletter subscriptions.
  2. Export the subscriptions as follows:
    • Go to the "Export" page with the path admin/people/simplenews/export.
    • Select active and subscribed users for one desired newsletter category and click the "Export" button.
    • Copy the list of email addresses, paste it into a text document, and save it to your computer.
    • Repeat the export process for other newsletter categories as needed.
  3. Import the subscription list:
    • Switch to your live website which uses the fixed Simplenews version.
    • Go to the "Mass subscribe" page with the path admin/people/simplenews/import.
    • Paste the addresses saved in step 2 into the "Email addresses" field.
    • Under "Subscribe to" further below, select the appropriate newsletter category.
    • Enable the "Force re-subscription" option.
    • Click the "Subscribe" button.
    • If the action was successful, you will see a message listing the imported addresses.
    • Repeat the import process for additional newsletter categories as needed.