If I want to delete a user account with the first three setting
Disable the account and keep its content.
Disable the account and unpublish its content.
Delete the account and make its content belong to the guest user.
I get following Fatal error:
The website encountered an unexpected error. Please try again later.
Recoverable fatal error: Object of class Drupal\Core\Field\FieldItemList could not be converted to string in Drupal\Core\Database\Statement->execute() (line 59 of core/lib/Drupal/Core/Database/Statement.php).
Drupal\Core\Database\Statement->execute(Array, Array) (Line: 624)
Drupal\Core\Database\Connection->query('DELETE FROM {comment_notify_user_settings}
WHERE uid = :db_condition_placeholder_0', Array, Array) (Line: 87)
Drupal\Core\Database\Driver\mysql\Connection->query('DELETE FROM {comment_notify_user_settings}
WHERE uid = :db_condition_placeholder_0', Array, Array) (Line: 55)
Drupal\Core\Database\Query\Delete->execute() (Line: 61)
comment_notify_delete_user_notification_setting(Object) (Line: 256)
comment_notify_user_cancel(Array, Object, 'user_cancel_block')
call_user_func_array('comment_notify_user_cancel', Array) (Line: 402)
......
But with the last option "Delete the account and its content" its no problem to delete the account.
After unistalling the module I dont have the problem
I reinstalled the module and there were also following notices:
Notice: Trying to get property of non-object in comment_notify_form_user_form_alter() (line 215 of modules/contrib/comment_notify/comment_notify.module).
comment_notify_form_user_form_alter(Array, Object, 'user_form') (Line: 501)
Drupal\Core\Extension\ModuleHandler->alter('form', Array, Object, 'user_form') (Line: 819)
Drupal\Core\Form\FormBuilder->prepareForm('user_form', Array, Object) (Line: 272)
Drupal\Core\Form\FormBuilder->buildForm('user_form', Object) (Line: 74)
Drupal\Core\Controller\FormController->getContentResult(Object, Object)
call_user_func_array(Array, Array) (Line: 123)
Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->Drupal\Core\EventSubscriber\{closure}() (Line: 574)
......
Notice: Trying to get property of non-object in comment_notify_form_user_form_alter() (line 231 of modules/contrib/comment_notify/comment_notify.module).
comment_notify_form_user_form_alter(Array, Object, 'user_form') (Line: 501)
Drupal\Core\Extension\ModuleHandler->alter('form', Array, Object, 'user_form') (Line: 819)
Drupal\Core\Form\FormBuilder->prepareForm('user_form', Array, Object) (Line: 272)
Drupal\Core\Form\FormBuilder->buildForm('user_form', Object) (Line: 74)
Drupal\Core\Controller\FormController->getContentResult(Object, Object)
call_user_func_array(Array, Array) (Line: 123)
.....
As long i dont want to keep content of users its not a problem ;-)
Comment | File | Size | Author |
---|---|---|---|
#5 | 2884595-5.patch | 2.48 KB | gnuget |
| |||
#5 | 2884595-5-test-only.patch | 1.4 KB | gnuget |
#2 | comment_notify-delete-error-2884595-2.patch | 525 bytes | kmonahan |
|
Comments
Comment #2
kmonahan CreditAttribution: kmonahan commentedI encountered the same fatal error when canceling user accounts but retaining the content, whether the cancellation was done by an admin or by allowing users to cancel their own accounts. Issue seems to be that $account->uid does not return the account ID integer but rather the Field Item object for the uid field. Changing to $account->id() fixes the issue for me.
Comment #3
kmonahan CreditAttribution: kmonahan commentedComment #4
id.conky CreditAttribution: id.conky as a volunteer commentedHave this issue too, #2 worked, but better to add type to $account function argument, like this: \Drupal\user\Entity\User $account
Comment #5
gnugetI had to modify a bit #2 because it seems that when an account is deleted (not canceled) the
hook_user_cancel()
is not triggered and the settings weren't deleted.That is why the "Delete the account and its content" option was apparently working.
Tests and patch.
David.
Comment #8
gnuget