- 🇩🇪Germany Anybody Porta Westfalica
Might be the same reasons as for 🐛 User associated contents are deleted Fixed ? Does this still happen?
- 🇫🇷France mably
It looks like unpublication is simply not implemented:
case 'user_cancel_block': case 'user_cancel_block_unpublish': if ($user->isBlocked()) { // The user is already blocked. Do not block them again. return; } $this->notifyUserToPurge($user); $user->block(); $user->save(); $this->messenger->addStatus($this->t('%name has been disabled.', ['%name' => $user->getDisplayName()])); $logger->notice('Blocked user: %name %email.', [ '%name' => $user->getAccountName(), '%email' => '<' . $user->getEmail() . '>', ]); break;
Is this still a desired feature?
- 🇫🇷France mably
Ok, it's done here when we call the
user_cancel
hook:// When the 'user_cancel_delete' method is used, user_delete() is called, // which invokes hook_ENTITY_TYPE_predelete() and hook_ENTITY_TYPE_delete() // for the user entity. Modules should use those hooks to respond to the // account deletion. if ($method != 'user_cancel_delete') { // Allow modules to add further sets to this batch. /* @see \user_cancel() */ $this->moduleHandler->invokeAll('user_cancel', [$edit, $user, $method]); }
And then the Node module unpublishes the contents here:
#[Hook('user_cancel')] public function userCancelBlockUnpublish($edit, UserInterface $account, $method): void { if ($method === 'user_cancel_block_unpublish') { $nids = $this->nodeStorage->getQuery() ->accessCheck(FALSE) ->condition('uid', $account->id()) ->execute(); $this->moduleHandler->invoke('node', 'mass_update', [$nids, ['status' => 0], NULL, TRUE]); } }
Closing this issue.
- 🇫🇷France mably
Actually a functional test covers the unpublication feature. So it's definitely working now.