Scheduled content cannot be edited

Created on 4 September 2024, 4 months ago
Updated 7 September 2024, 3 months ago

Problem/Motivation

Content which is published or unpublished automatically cannot be edited. An error is generated when attempting to edit. This seems to be caused because the anonymous user is identified as the revision user when automatically publishing or unpublishing. When any other user is selected as the revision user, this error is eliminated. Drupal appears to be identifying the revision user as a null, causing the issue.

Steps to reproduce

Create Content and set automated publishing or unpublishing.
Wait for the new revision to be created with the anonymous user as the author.
Edit the content after automated scheduling changes have been applied by the anonymous user.
Receive This Error:

Message Error: Call to a member function getAccountName() on null in Drupal\node\NodeForm->form() (line 162 of /var/www/html/web/core/modules/node/src/NodeForm.php).

Backtrace
#0 /var/www/html/web/core/lib/Drupal/Core/Entity/EntityForm.php(107): Drupal\node\NodeForm->form()
#1 [internal function]: Drupal\Core\Entity\EntityForm->buildForm()
#2 /var/www/html/web/core/lib/Drupal/Core/Form/FormBuilder.php(536): call_user_func_array()
#3 /var/www/html/web/core/lib/Drupal/Core/Form/FormBuilder.php(284): Drupal\Core\Form\FormBuilder->retrieveForm()
#4 /var/www/html/web/core/lib/Drupal/Core/Controller/FormController.php(73): Drupal\Core\Form\FormBuilder->buildForm()
#5 /var/www/html/web/core/modules/layout_builder/src/Controller/LayoutBuilderHtmlEntityFormController.php(39): Drupal\Core\Controller\FormController->getContentResult()
#6 [internal function]: Drupal\layout_builder\Controller\LayoutBuilderHtmlEntityFormController->getContentResult()
#7 /var/www/html/web/core/lib/Drupal/Core/EventSubscriber/EarlyRenderingControllerWrapperSubscriber.php(123): call_user_func_array()
#8 /var/www/html/web/core/lib/Drupal/Core/Render/Renderer.php(638): Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->Drupal\Core\EventSubscriber\{closure}()
#9 /var/www/html/web/core/lib/Drupal/Core/EventSubscriber/EarlyRenderingControllerWrapperSubscriber.php(124): Drupal\Core\Render\Renderer->executeInRenderContext()
#10 /var/www/html/web/core/lib/Drupal/Core/EventSubscriber/EarlyRenderingControllerWrapperSubscriber.php(97): Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->wrapControllerExecutionInRenderContext()
#11 /var/www/html/vendor/symfony/http-kernel/HttpKernel.php(181): Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->Drupal\Core\EventSubscriber\{closure}()
#12 /var/www/html/vendor/symfony/http-kernel/HttpKernel.php(76): Symfony\Component\HttpKernel\HttpKernel->handleRaw()
#13 /var/www/html/web/core/lib/Drupal/Core/StackMiddleware/Session.php(53): Symfony\Component\HttpKernel\HttpKernel->handle()
#14 /var/www/html/web/core/lib/Drupal/Core/StackMiddleware/KernelPreHandle.php(48): Drupal\Core\StackMiddleware\Session->handle()
#15 /var/www/html/web/core/lib/Drupal/Core/StackMiddleware/ContentLength.php(28): Drupal\Core\StackMiddleware\KernelPreHandle->handle()
#16 /var/www/html/web/core/modules/big_pipe/src/StackMiddleware/ContentLength.php(32): Drupal\Core\StackMiddleware\ContentLength->handle()
#17 /var/www/html/web/core/modules/page_cache/src/StackMiddleware/PageCache.php(106): Drupal\big_pipe\StackMiddleware\ContentLength->handle()
#18 /var/www/html/web/core/modules/page_cache/src/StackMiddleware/PageCache.php(85): Drupal\page_cache\StackMiddleware\PageCache->pass()
#19 /var/www/html/web/modules/contrib/cleantalk/src/EventSubscriber/BootSubscriber.php(193): Drupal\page_cache\StackMiddleware\PageCache->handle()
#20 /var/www/html/web/core/modules/ban/src/BanMiddleware.php(50): Drupal\cleantalk\EventSubscriber\BootSubscriber->handle()
#21 /var/www/html/web/core/lib/Drupal/Core/StackMiddleware/ReverseProxyMiddleware.php(48): Drupal\ban\BanMiddleware->handle()
#22 /var/www/html/web/core/lib/Drupal/Core/StackMiddleware/NegotiationMiddleware.php(51): Drupal\Core\StackMiddleware\ReverseProxyMiddleware->handle()
#23 /var/www/html/web/core/lib/Drupal/Core/StackMiddleware/AjaxPageState.php(36): Drupal\Core\StackMiddleware\NegotiationMiddleware->handle()
#24 /var/www/html/web/core/lib/Drupal/Core/StackMiddleware/StackedHttpKernel.php(51): Drupal\Core\StackMiddleware\AjaxPageState->handle()
#25 /var/www/html/web/core/lib/Drupal/Core/DrupalKernel.php(741): Drupal\Core\StackMiddleware\StackedHttpKernel->handle()
#26 /var/www/html/web/index.php(19): Drupal\Core\DrupalKernel->handle()
#27 {main}

Proposed resolution

Scheduler should allow the revision user to be specified in the automated scheduler options, rather than defaulting to the anonymous user or the cron user. Alternatively the revision user should be the original content author if no user is specified.

At the very least the user should never be null, which seems to cause the issue.

Each content can be fixed individually by reverting it to the last revision which was edited by an actual user (not null or anonymous). Reverting to any revision made by the anonymous user on any piece of content results in an error on the edit page of the content.

💬 Support request
Status

Postponed: needs info

Version

1.5

Component

User Interface

Created by

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

Comments & Activities

  • Issue created by @jbuttler
  • Status changed to Postponed: needs info 3 months ago
  • 🇬🇧United Kingdom jonathan1055

    Hi jbuttler,
    In general, scheduled content can be edited. I know this from use of the module, and also it is demonstrated by numerous phpunit tests, such as SchedulerDefaultTime, SchedulerDeleteNode and SchedulerFieldsDisplay. So in principle the module is working.

    However, your error shows that you do have a problem somewhere, so this must be caused by the interaction with another module. I notice that the backtrace does not actually include any scheduler function or file. So it does not seem that this module is the primary cause for your error.

    If you can list the full "steps to reproduce" starting with a fresh install of a Drupal site, you should be able to determine which other modules are needed to cause this error.

Production build 0.71.5 2024