timlovrecic / Webform-Protected-Downloads

Recreation of Webform Protected Downloads for Drupal 8
5 stars 8 forks source link

Fatal error after deleting Results record #9

Open MikaelBerger opened 6 years ago

MikaelBerger commented 6 years ago

I have spotted a rather odd error, after doing the following:

  1. Fresh Drupal 8 install
  2. Fetching webform, token and smtp with composer and cloning this module as webform_protected_downloads
  3. Activating Webform, Webform UI, SMTP, Token and this module
  4. Inserting a simple webform with just an e-mail field, a protected download (pdf) and a Settings -> E-mail with a custom message that contains the protected download token.

This worked just fine until I purge or delete some submission results. After that, testing the form just leads to "The website encountered an unexpected error. Please try again later." The only ways to fix it seem to be either to remove the token from the e-mail or to reinstall the module.

I enclose the Drupal log message for the PHP error. It comes from a local WAMP environment but the error also occurs in my Production Linux server.

Webform error.txt

cdstg commented 5 years ago

yes same problem for me Call to a member function getValue() on null in WebformProtectedDownloads.php on line 33

stevan990 commented 5 years ago

You can purge all content that belong to "Webform Protected Downloads" entity type, and it will solve problem.

drupal entity:delete webform_protected_downloads --all

redseujac75 commented 4 years ago

Also same problem for me. This should NOT happen. As to me this is a BUG in the module. How to purge content belonging to WPD entity type the normal way, i.e. without "drupal entity:delete webform_protected_downloads --all" ? Edit: OK, I found, installed and used the Entity Delete module. Works like a charm!

alphex commented 4 years ago

Had this same problem also. The entity_delete module functionality seems to fix it, but oof.

alphex commented 4 years ago

For anyone else coming here for this. Install the Entity Delete (entity_delete) module and delete all of the entities titled Webform Protected Downloads at /admin/config/entity-delete

Its a vaguely described interface that doesn't quote make it clear what its doing... but it worked.

Always, test your functionality in a safe space before doing it on PROD.

redseujac75 commented 4 years ago

Entity Delete module doesn't work in Drupal 9.0.0 and gives multiple errors. So, same problem persists after purging/deleting submissions.

redseujac75 commented 4 years ago

Fortunately I have found a nice workaround, even without the need of a specific module. The solution lies in Drupal 9 itself. After purging/deleting submissions, go to /admin/modules/uninstall. Next go to Filter by name or description and enter e.g. "prot" (from 'protected'). The module name 'Webform Protected Downloads' will be shown. If there exists content belonging to "Webform Protected Downloads" entity type, the checkbox will be grayed out and at the right side under Description header you will find a link to delete the Webform Protected Downloads entities (without having to uninstall the module).

anotherjames commented 8 months ago

The new version of this back on https://www.drupal.org/project/webform_protected_downloads incorporates a fix for these problems :)