Bug Service XF\Service\User\Delete prevent delete self-account

There is a bug in this version
T

truonglv

Guest
I have been setup to allow user can delete their account which used \XF\Service\User\Delete service.

PHP:

Code:
/** @var \XF\Service\User\Delete $deleter */
$deleter = $this->service('XF:User\Delete', $visitor);
$deleter->renameTo('guest-' . time());
$deleter->getUser()->setOption('allow_self_delete', true);

if (!$deleter->delete($errors)) {
     return $this->error($errors);
}

But with the line 55 in service it resets all options and then when invoke delete() again; it triggers preDelete...

Read more

Continue reading...