Filter anonymous author from Workbench Email form selection

Created on 14 January 2023, over 1 year ago

Problem/Motivation

We have found that Drupal will produce a fatal error (white screen of death) if the node author is set to anonymous, the Workbench Email form selection is displayed when the state is changed, and no other updates are made to set which users are notified. The error generated is as follows:

PDOException: in drupal_write_record() (line 7603 of /includes/common.inc).

Steps to reproduce

Enable Workbench Email for a node, set states of "draft" and "publish", and have the email form selection be displayed when switching from draft to publish. Create the node, set the node author to anonymous (blank), and change the node state to "publish".

At that moment, it can be seen the "Original Author" select form item has been generated, and the initial entry (with a value of nothing) is set as selected in the HTML. This is the critical problem -- the code will then attempt to send an email to a user that has no address. Since this is the anonymous user, it generates a critical error.

Proposed resolution

See the attached patch. It is simple enough to check for anonymous account records when filtering users, and skip them if present. This will ensure they are not included in the Workbench Email selects.

This patch is somewhat of a continuation of a committed patch from a few years ago, which was for anonymous users submitting nodes, whereas this situation is for administrative users submitting nodes and setting the author to anonymous: https://www.drupal.org/project/workbench_email/issues/2529016 β†’

Remaining tasks

Please review the attached patch and let me know if any further updates are necessary. Thank you.

πŸ› Bug report
Status

Needs review

Version

3.12

Component

Code

Created by

πŸ‡ΊπŸ‡ΈUnited States ron_s

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.

No activities found.

Production build 0.69.0 2024