The closeAccount
hook is triggered when a user closes their account. It passes
the user ID, the operation mode and the module as arguments and does not expect
a return value.
The operation mode will either be close_deactivate
or close_delete
.
int $userId
ID of the user which closed their account.
string $mode
The “close account” mode. Either close_deactivate
or close_delete
.
\Contao\Module $module
The front end module object. This allows you to retrieve all data from the
current tl_module
result set.
// src/EventListener/CloseAccountListener.php
namespace App\EventListener;
use Contao\CoreBundle\DependencyInjection\Attribute\AsHook;
use Contao\Module;
#[AsHook('closeAccount')]
class CloseAccountListener
{
public function __invoke(int $userId, string $mode, Module $module): void
{
// Do something …
}
}